in reply to Parsing text file question
chomp( my @array = <FILE> ); foreach my $previous_line_no ( 0 .. $#array ) { # count through the ar +ray. # runs over its bounda +ry, hmm. # see with warnings on +. my $line_no = $previous_line_no + 1; if ( $array[$line_no] =~ m/fail/ ) { splice( @array, $previous_line_no, 1 ); # take that previous l +ine out. } }
Cheers, Sören
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing text file question
by integral (Hermit) on Jun 28, 2004 at 08:27 UTC | |
|
Re^2: Parsing text file question
by neniro (Priest) on Jun 28, 2004 at 08:31 UTC | |
by sashac88 (Beadle) on Jun 28, 2004 at 08:58 UTC | |
by neniro (Priest) on Jun 28, 2004 at 09:06 UTC |