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

Sorry, I missed the task. The following should work:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; chomp (my @lines = <>); for (0..$#lines) { $lines[$_-1] = undef if ($lines[$_] =~ /fail/)}; @lines = grep (defined, @lines); print Dumper \@lines;