Perl chomp turn multiple digit number into 1 or 0
I have a situation where I need to read a file full of numbers in Perl. This work开发者_开发问答s fine in and of itself, but when I try to chomp each line it's turning the numbers that used to be 5 or 6 digits into either 1 or 0.
Ideas?
I need to chomp the numbers to assemble file paths with them, so the carriage returns are a problem.
You're not using chomp
like
$line = chomp($line)
are you? The return value of chomp
is the number of characters removed from the input, and not a chomped line of input. Instead you just want to say
chomp($line)
精彩评论