The <FILE> doesn't read into $_. You can add a 'print $_;' in there to verify it. I think you're getting confused by the while(<FILE>){...} structure. This puts the result of the readline into $_ for you if the <FILE> is the only thing in the '()'. Otherwise, I believe just calling <FILE> on a line by itself sends that line to the bit bucket. Hope this helps. Peter C. -----Original Message----- From: Gary Luther [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 15, 2001 11:01 AM To: [EMAIL PROTECTED] Subject: Perplexing problem.........probably beginners luck?? I have a test file that looks like this: TAXFN A GREAT BIG TITLE PAGE: 1 A SMALL TITLE RUN DATE: 05/01/01 SUBTITLE I read down into the file until I find a match on "A SMALL TITLE". I then call a subroutine to further process the file. I am looking for the report id which is TAXFN and the run date. This code works: seek(FILE,0,0); # Back to the beginning of file $reread = <FILE>; chomp($reread); print "$reread\n"; $reread =~ /(\s*\w+)/; $REPID = $1; $REPID =~ s/^\s+//; $REPID =~ s/\s+$//; print "Report ID = $REPID\n"; <FILE>; chomp; /(\d{2})\D(\d{2})\D(\d{2})/; print "Run Date = $1\/$2\/$3\n"; while this code doesn't: seek(FILE,0,0); # Back to the beginning of file <FILE>; /(\s*\w+)/; $REPID = $1; $REPID =~ s/^\s+//; $REPID =~ s/\s+$//; print "Report ID = $REPID\n"; <FILE>; chomp; /(\d{2})\D(\d{2})\D(\d{2})/; print "Run Date = $1\/$2\/$3\n"; In the doesn't work code I always end up with the second line. Why does reading into a variable instead of $_ make a difference? Why does the read for the date work with $_ just fine?? I am confused. TIA for any thoughts. -- ------------------------------------------------------------------------- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin ------------------------------------------------------------------------- RRRRR Gary Luther RR RR SAF RR RR UTABEGAS 2500 Broadway RR RR Helena, MT 59602 RRRR [EMAIL PROTECTED] RR RR ULE !! RR RR Visit our website at RR RR http://www.safmt.org