Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: make subroutine that takes expression as implicit block as first arg

by oko1 (Deacon)
on Aug 13, 2010 at 19:54 UTC ( #854996=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Type of arg 1 to main::mygrep must be block or sub {} (not numeric eq 
    +(==)) at /tmp/mygrep line 7, near "10)"
    Execution of /tmp/mygrep aborted due to compilation errors.
    
  2. or download this
    sub mygrep { my $s = "grep $_[0]"; eval $s; }
    
    print for mygrep('$_ % 2 == 0, 0..10');    # :-)
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2023-09-22 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?