in reply to How do I find the array element directly preceeding a 'match'?
where $last holds the "preceeding list element" of the current item and $found holds the "preceeding list element" of the item that matches.foreach $item (@array) { if (matches($item)) { $found = $last; last; } $last = $item; }
|
|---|