in reply to the chomp does not seem to work

chop removes the final character of a line even if it's not an official newline, so you can use it as many times as you like, eg.
$x="hello world\n"; chop $x; chop $x; chop $x;
leaves "hello wor" -- chop chop until you get what you want, if all else fails.