Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: grep { $var } @arr

by Anonymous Monk
on Jul 17, 2014 at 14:58 UTC ( [id://1094071]=note: print w/replies, xml ) Need Help??


in reply to grep { $var } @arr

You are not using a pattern which, to me, implies m// or index() use; you are actually using a code block.

Use a list of sub references to iterate over instead ...

@test = ( sub { $_[0] < 3 } ); for my $t ( @test ) { print join q[ ] , grep $t->( $_ ), 1 .. 5; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-28 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found