in reply to WHILE and DEFINED problem
$.02open (IN,"<" . "c:/tmp.txt") or die "Doh: $!"; # Use ()'s, and added o +r die... sometimes that comes in hand when debugging. while(<IN>){ # $_ is set to each line for each file. my $line = $_; # Take raw form of line $line =~ chomp $line; # chomp the line. if (length($line)){ # does line have non zero length? (Sorta what y +ou're doing.) print "$line\n"; } } close IN; # Clean up.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: WHILE and DEFINED problem
by demerphq (Chancellor) on Mar 06, 2004 at 20:50 UTC |