> the chomp(EXP) function remove the last character from EXP(or $_) only if 
> that character is a newline for your OS. chomp() knows what newline your OS 
> uses so you don't have to worry about it. again, chomp doesn't remove 
> spaces(unless you happen to treat newline and space is the same).

Actually chomp removes any trailing string that is the same as the 
contents of $/. perldoc -f chomp, perldoc perlvar. 

By default $/ is set to a newline. You can do something like this
local $/ = "   ";
my $str = "abc   ";
chomp ($str);
print "$str###\n";

This will print abc###, the three trailing spaces are removed by chomp.
Ofcourse the contents of $/ can only be a string not a regex. This means 
you cannot use this to remove any number trailing spaces. The regex is the 
right way to do it :-)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to