Wc -Sx- Jones wrote: > > Harry Putnam wrote: > > "R. Joseph Newton" <[EMAIL PROTECTED]> writes: > >> > >>Why here. Since you are doing this with each line, you could write in the loop > >>control: > >>while (my $line = <FILE>) { > > > > Not sure I understand the advantage. In my formulation, `$line' is > > minus the trailing newline... which I've found to be nearly always a plus. > > then chomp that - > > while (chomp(my $line = <FILE>)) { > > smaller understandable -- the same as the orignal.
It is definitely NOT the same as the original! while ( my $line = <FILE> ) { is the same as: while ( defined( my $line = <FILE> ) ) { Which will return ALL data from the file until EOF has been reached. chomp() returns the number of $/ that have been removed so if the value of $/ is not present in the last "line" of the file it will be skipped entirely. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>