in reply to Parsing Test File

Chomp returns the number of characters removed, not the actual characters removed.
Chomp will also only remove the $/ , or input record seperator variable.
Replacing the chomp with chop might do as you expect.
See perlvar and perlfunc for more information
Hope this helps
davis

Update The reply by Vsarkiss makes more sense.

Replies are listed 'Best First'.
Re^2: Parsing Test File
by Aristotle (Chancellor) on Jan 15, 2002 at 23:00 UTC

    Just for completeness' sake, I'd like to mention one should always prefer chomp over chop for stripping end-of-line characters. The most obvious example of why is if the last line in the file has no trailing newline. In that case chop will break - it will eat a character from your payload. chomp will still do the right thing (which is nothing, in this case).

    Unless you really want to remove the last character of every line, regardless of what that may be, you shouldn't chop.

Re: Re: Parsing Test File
by gri6507 (Deacon) on Jan 15, 2002 at 21:05 UTC
    thank you. That makes perfect sense.