At 14:56 -0500 10/10/11, Chris Stinemetz wrote:
Once I match HEH how can alter the program to print the contents that are in the two lines directly above the match?
If it's only one instance you need to deal with then this should do the trick: #!/usr/bin/perl use strict; my @lines; while (<DATA>){ chomp; s/#.*$//; push @lines, $_; last if /HEH/; } print "$lines[-1] Timestamp: $lines[-3]"; __END__ JD -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/