Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Grep Pattern

by LanX (Saint)
on Dec 20, 2018 at 14:34 UTC ( [id://1227528]=note: print w/replies, xml ) Need Help??


in reply to Grep Pattern

slightly cheating ;-)

DB<33> x @a=(0,1,1); grep { (each @a)[1] } A..L 0 'B' 1 'C' 2 'F' 3 'G' 4 'J' 5 'K'

here the general case w/o cheating:

(like when the filter cycle ends with a 1 you'd need)

DB<34> x @a=(0,0,1,1); grep { (each @a)[1] // (each @a)[1] } A..L 0 'C' 1 'D' 2 'G' 3 'H' 4 'K' 5 'L'

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-23 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found