some way to do it that was native to Perl.
The "native" way: with a closure:
my $variable = 3; my $string = sub { return "Variable: $variable\n"; }; print &$string; $variable = 4; print &$string;
I assume here that by "native" you mean "without using a module". However, be advised that many modules are written using "native" pure perl and that modules are as much a part of the language as the print function.
In reply to Re^3: Dynamic interpolation in a string with a scalar variable?
by hippo
in thread Dynamic interpolation in a string with a scalar variable?
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |