Hamish Moffatt wrote:
> If you just want to trim spaces, something like
> 
> $var =~ s/\s*?(\S)/$1/;
> 
> should do the trick. No doubt there are better ways.

The canonical answer (listed, e.g., in `perldoc -q "strip blank space"`),
is:

    $var =~ s/^\s+//;

and for end:

    $var =~ s/\s+$//;

If you want both left and right trimmed, it's faster (it says) to do the
above two, rather than trying to combine them into one regex. And \s+ is
better than \s* because it won't have to do any work if there isn't any
blank space at the beginning or end.

Cheers,
Philip

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to