use strict; use warnings; my $flag = 0; while (my $line = ) { if ($flag) { print $line; $flag = 0; } if($line =~ /SQL/) { chomp(my $date = `date`); chomp (my $errcode = $line); print "$date - $errcode\n"; $flag = 1; }#end of if }#end of while __DATA__ Sun Sep 19 10:34:29 2010 Online Backup for GMT failed. SQL2033N An error occurred while accessing TSM during the processing of a database utility. Reason code: 1.