> - chomp($line); > + $line =~ s/[\r\n]//g; I'm not sure what this is supposed to do but, if you want to strip any combination of /r and /n from the end of the line, won't you need a repeat specifier, e.g.: $line =~ s/[\r\n]+//g; R.