in reply to File search question
But if the text file was made on one OS and the script is running under a different OS (and if it's not gauranteed that the file has not gone through a dos2unix or unix2dos filter), then you're better off using the regex approach. To get effectively the same behevior as a working "eq", just anchor the beginning and ending of the regex:while (<FILE>) { chomp; if ( $_ eq "testpoint" ) { last; } }
while (<>) { if ( /^testpoint\s*$/ ) { last; } }
|
|---|