Next | Tricks of the Wizards | 63 |
This nifty trick was invented by Andrew Pimlott
Beginners want to say this:
$salary = 43_000; print "After your raise, you will make $salary*1.06.\n";
But it doesn't work:
After your raise, you will make 43000*1.06.
Because, of course, expressions aren't evalauted inside of strings.
...or are they?
@s = (1, 4, 9, 16, 25, 36); print "$s[(2+7-1*3)/2]\n"; # Prints 16
Next | Copyright © 2003 M. J. Dominus |