Rob Dixon wrote: > > Amit Saxena wrote: >> >> while (chomp ($str = <PTR1>)) > > That will exit the loop if an empty line is encountered before the end of the > file, and will throw a warning at the end of the file because of chomp having > an > uninitialized value
My apologies; chomp returns the number of characters removed from the end of the line, so empty lines in the middle of the file will be processed normally. But: - If the last line of the file ends in a record separator (newline by default) then all lines will be read but you will get a "Use of uninitialized value in chomp" error at the end of file - If the last line of the file doesn't end in a record separator then chomp will return zero and the last line of the file will be skipped. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/