Sorry about the inaccuracy but I hand-typed the code
Copy and paste is your friend. If you don't want to post the code you ran, at least run the code you post!
it is working now that I changed open(FILE, "$File") to open(FILE, "<", "$File")
That's a start, but one of the mantras around here is: "Always use strictures (use strict; use warnings; - see The strictures, according to Seuss), always use the three parameter version of open, always use lexical file handles and always check the result of I/O". Taking all that on board your open should have looked more like:
open my $inFile, '<', $file or die "Failed to open $file: $!";
Although that doesn't at all explain the chomp oddity you saw. More likely reasons for that behaviour are that you were reading a file generated with different line endings than are native on your OS or something had messed with $/ (see perlvar $/).
In reply to Re^3: chomp removes everything *except* the newline?
by GrandFather
in thread chomp removes everything *except* the newline?
by follier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |