Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


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... :-)
  • Comment on Re: Re: Re (tilly) 1: how can I access code ref contents, not call it?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://49831]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-23 21:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found