while (defined my $line = ) { chomp; # remove \n from the end of the line ... }