in reply to removing all whitespace but newlines
If you need to remove just trailing whitespace, change it to this:$line =~ s/[^\S\n]+//g;
$line =~ s/[^\S\n]+$//g;
Update: I should point out explicitly that that's a capital S inside the character class... the character class matches anything that's non-non-whitespace (i.e., whitespace) and non-newline.
-- Mike
--
just,my${.02}
|
|---|