in reply to chomp problem

it's probably the windows newline characters in there.. try s/[\r\n]+$//; instead of chomp (you could probably change the $/ variable instead -- see perldoc perlvar and perldoc -f chomp).

side note: you can do ./test.plx < symbols.txt instead of the useless cat. note also that this can be written as:
perl -e 's/([\r\n]+)$/ is the symbol$1/' symbols.txt

Replies are listed 'Best First'.
Re^2: chomp problem
by sgifford (Prior) on Aug 17, 2005 at 20:52 UTC
    To elaborate a little bit on why you'd get this strange behavior, Windows encodes line endings as CR/LF, that is a carriage-return (return to the beginning of the line) followed by a linefeed (advance to the next line). So if you strip off just the linefeed, you end up with this in your string:
    FORM<CR> is the symbol<LF>
    That tells your terminal to print FORM, then return the cursor to the beginning of the line and print is the symbol---which is now right on top of FORM---and finally advance to the next line.

    If you pipe this through less, od, or hexdump, you should be able to see this is what's going on.