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.