tags:

views:

65

answers:

1
+1  Q: 

perl chomp problem

I have a situation where I need to read a file full of numbers in perl. This works 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.

+7  A: 

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)
mobrule
Thanks. That would be the problem.
chuck taylor
`chomp`'s interface is a design mistake. It takes many people for surprise. [`Text::Chomped`](http://p3rl.org/Text::Chomped) however does the right thing.
daxim