[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] arithmetic within a string?



pns@virginia.edu (Paul N. Schatz) wrote:
>	Am I correct that there is no way to have the arithmetic occur
>within the string?
>
>For example
>
>print "3.4*5.6 = `3.4*5.6`\n"; # gives 3.4*5.6 = `3.4*5.6`---Not = 19.04.

There are some tricks.  Here's one.

print "3.4*5.6 = @{[3.4*5.6]}\n";

It's not voodoo, so if you don't know what it means it's worth your time
to work your way through it and understand it.  This can be a handy
method for inserting things in the middle of a string, particularly with
big bulky delimiters like here-docs.


  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  ken@forum.swarthmore.edu                            The Math Forum



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org