Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Calling a function from within a HERE doc?by bart (Canon) |
on Aug 17, 2005 at 19:06 UTC ( [id://484537]=note: print w/replies, xml ) | Need Help?? |
You can do this, as well as interpolation in more normal double-quoted strings, with the module Interpolation, originally written by dominus as a joke, currently maintained by Jenda.
I don't like the import interface, I think you should just call a tie a tie, but you can just use tie with the module without any changes. (Be sure to have at least one more line under "END") The key to how this works is that an index to a hash or an array is always interpreted as perl code. Next, a tied hash is used to execute an associated function, instead of actually fetching a hash value out of somewhere.
In Section
Seekers of Perl Wisdom
|
|