Chomp removes newlines not spaces.
Code:
my $val = "hhh \n";
print "$val";print "h\n";
chomp ($val);
print "$val";print "h";
that will print out
thats for 5.8, i forget about prevous versions.
reference:
http://www.perldoc.com/perl5.8.0/pod/func/chomp.html