Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How do I find the array element directly preceeding a 'match'?

by amelinda (Friar)
on Oct 13, 2000 at 03:30 UTC ( [id://36535]=note: print w/replies, xml ) Need Help??


in reply to How do I find the array element directly preceeding a 'match'?

Try this:
foreach $item (@array) { if (matches($item)) { $found = $last; last; } $last = $item; }
where $last holds the "preceeding list element" of the current item and $found holds the "preceeding list element" of the item that matches.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found