Syntactic Confectionery Delight | |
PerlMonks |
Re: Re: Re (tilly) 1: how can I access code ref contents, not call it?by knight (Friar) |
on Jan 04, 2001 at 23:23 UTC ( [id://49831]=note: print w/replies, xml ) | Need Help?? |
If you have an eval(), why not use it.
Quoting. Creating a complex subroutine in text gets decidedly non-trivial and hard to maintain when you have to remember to not escape $foo because you want it interpolated but to escape \$bar because it's a local variable in your text's code. For many situations, a good old anonymous subroutine reads a lot cleaner. Cons actually already supports Perl code snippets in text, so this is an empirical observation. Both approaches do have their advantages and disadvantages. (Besides, providing both mechanisms would give people More Than One Way To Do It... :-)
In Section
Seekers of Perl Wisdom
|
|