in reply to Re: Re (tilly) 1: how can I access code ref contents, not call it?
in thread how can I access code ref contents, not call it?
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... :-)