good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^3: Use with variableby Aristotle (Chancellor) |
on Sep 08, 2004 at 22:11 UTC ( [id://389494]=note: print w/replies, xml ) | Need Help?? |
Actually, you don't need to interpolate the variable, and it's much safer not to:
That's because use $var actually works. You just have to somehow populate $var before the compile-time effect of use takes place. A BEGIN block lets you do that. Silly example:
Note that the snippets of course aren't equivalent — the first loads the module at runtime, the second loads it at compile time. Makeshifts last the longest.
In Section
Seekers of Perl Wisdom
|
|