>>>>> "SHC" == Shawn H Corey <[email protected]> writes:
SHC> Dr.Ruud wrote:
>> Jeff Peng wrote:
>>
>>> so how about while (my $line = <FILE>) instead of using $_?
>>
>> Evil! An empty line, or a line with only a "0" in it.
>>
SHC> Not quite. Lines are not completely empty. A blank line would have
SHC> "\n". A line with just zero would have "0\n". Only after a chomp would
SHC> the test fail.
SHC> WARNING: Evil code, do not use:
SHC> while( chomp( my $line = <FILE> )){
that is even more evil as it checks the result of chomp which is the
character chomped. a partial line without a trailing $/ (typically
newline) will fail that test as nothing gets chomped.
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/