my $SentRec; open(LOGFILE, "$LogDir$Filename") or return "Error: Open of $Filename failed: $!\n"; while (){ if (/\b$Autosys/) { print "the full string: $_\n"; $SentRec = substr($_, 0, 28); $count++; } #sample output 07/25/05 09:03:56 p2.ipgprd.nscc.bti.arch.d Archived BTIHDR.000.137660435.Z 07/25/05 09:04:11 p2.ipgprd.nscc.bti.arch.d Archived ML2001788C.137660435.Z 07/25/05 09:04:37 p2.ipgprd.nscc.bti.arch.d Archived ML2001789D.137660435.Z