http://www.perlmonks.org?node_id=370144


in reply to Re: Parsing text file question
in thread Parsing text file question

How about using redo and a c-style for loop?

my (@array, $i); @array = <FILE>; for ($i = 0; $i <= $#array; $i++) { if ($i > 0 and $array[$i] =~ /\bfail\b/) { splice @array, $i - 1, 1; redo; } }

--
integral, resident of freenode's #perl