Lee Goddard wrote: > What's wrong with: > > s/^\s+(.*[^\s]+)\s+$/$1/sg;
the (possibly) wrong part is that your regex fails unless there are whitespaces *both* in front and at the end of the string. try this: $str = "this is a test files "; $str =~ s/^\s+(.*[^\s]+)\s+$/$1/sg; print "<", $str, ">\n"; trailing spaces are not removed. I'd suggest this instead: $str =~ s/^\s+|\s+$//g; cheers, Aldo __END__ $_=q,just perl,,s, , another ,,s,$, hacker,,print; _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs