Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Grep Pattern

by LanX (Cardinal)
on Dec 20, 2018 at 14:34 UTC ( #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
Node Status?
node history
Node Type: note [id://1227528]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2020-11-26 16:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?