http://www.perlmonks.org?node_id=1059690


in reply to same script, different results

If you run the script on Unix ($/ = "\n"), but the files are saved on Windows ($/ = "\r\n"), you'll get botched result. Don't trust chomp, use s/\s*$//s instead. Or better yet, use regexp matching and capturing (this is what -T mode and perlsec would suggest):
while (<SYM>) { m/($insert_expected_symbol_format_here)/ or die "Bad input format"; # or maybe just "or next" my $symbol = $1; };