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!
$name = " Dave Gilden    ";
($name) = ($name =~ m/^\s*([\w .-]{1,120})/);
print "|$name|";


I know there should be a simple way to this via grep....

Thanks in advance for any direction on this problem,

Dave Gilden

(kora musician / audiophile / webmaster @ www.coraconnection.com  / Ft. Worth, 
TX, USA)

--
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