David Gilden wrote:
I am trying to trim white space, at the front and end of a string.
The following is not working....

#!/usr/bin/perl
$name = " Dave Gilden    ";
$name =~ s/^\s*([\w .-]{1,120})\s*$/$1/;
print "|$name|";


# This gets the front but not the back!

You're only doing it once:
s{}{}
you need to do it "globally":
s{}{}g

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to