Philip Potter wrote:
2009/11/2 Thomas Bätzler <[email protected]>:while( my $line = <$file> ){ <snip> }Won't this loop terminate early if there is a blank line or a line containing only '0'? If I do a readline loop I always do: while (defined ($line = <$file>)) Is there something magical happening here I don't know about? I know about the magical: while (<$file>) which is equivalent to: while (defined($_ = <$file>)) but I don't know of any magic in the while loop at the top.
Whether you use: while ( <FH> ) Or: while ( my $line = <FH> ) The condition is always tested for undefinedness. John -- The programmer is fighting against the two most destructive forces in the universe: entropy and human stupidity. -- Damian Conway -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
