in reply to print chomp <STDIN>
You're not using chomp() right. chomp($string) actually modifies $string itself, and its return value is not what you want to print -- it's 1 if chomp did something, 0 if not.
see http://perldoc.perl.org/functions/chomp.html