in reply to Re^11: Order of evaluation/interpolation of references
in thread Order of evaluation/interpolation of references
> "The price is: $obj->tostring()\n";? Isn't evaled for me,
I know. But wouldn't it be convenient if it was interpolated(*)?
See http://szabgab.com/perl-6--scalar-array-and-hash-interpolation.html
Just expressions: say "Take 1+4";
will print: Take 1+4
as expected but as I wrote you can put any expression in the curly braces, so you can also write: say "Take {1+4}";
that will print: Take 5
Isn't that nicer than print "Take " . ( 1 + 4 ) . "\n";?
And remember, interpolation is not like string eval, more like block eval. It can be compiled at compile time, and just run on demand.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^13: Order of evaluation/interpolation of references
by trwww (Priest) on Mar 08, 2012 at 16:51 UTC | |
by JavaFan (Canon) on Mar 08, 2012 at 17:40 UTC | |
by BrowserUk (Patriarch) on Mar 08, 2012 at 19:37 UTC |