Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Array searching, grep, first

by jimbus (Friar)
on Sep 01, 2005 at 18:13 UTC ( #488445=note: print w/replies, xml ) Need Help??

in reply to Re: Array searching, grep, first
in thread Array searching, grep, first

There are usually 90-120 lines in the CSV per day, so I'm not sure it matters.

Can I get a little explaination on whats going on with grep { $csvlist[$_] =~ /$x/} 0..$#csvlist; it looks like it would be useful.


Never moon a werewolf!

Replies are listed 'Best First'.
Re^3: Array searching, grep, first
by friedo (Prior) on Sep 01, 2005 at 18:29 UTC
    What's going on here is that the list that is being greped consists of the numbers 0..$#csvlist. (Or zero through the highest index in the array.) The conditional inside the grep block looks at the array item indexed at each number and returns that number if the condition is true.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://488445]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-04-24 21:35 GMT
Find Nodes?
    Voting Booth?