open (IN,"<" . "c:/tmp.txt") or die "Doh: $!"; # Use ()'s, and added or die... sometimes that comes in hand when debugging. while(){ # $_ 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 you're doing.) print "$line\n"; } } close IN; # Clean up.