Jeff Pang schreef:
> John W. Krahn:
>> Tony Heal:

>>> Why doesn't this work? I want to take any leading 
>>> or trailing white spaces out. 
>> 
>> perldoc -q "How do I strip blank space"
> 
> Or generally it could be done by,
> $string =~ s/^\s+|\s+$//g;

The g-modifier doesn't mean "generally" nor "good". ;-) 
Please see the suggested perldoc text for the proper ways. 

I like to use:

  s/^\s+//, s/\s+$// for $string;

but

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

may be slightly faster.
(like because no localization of $_) 

-- 
Affijn, Ruud

"Gewoon is een tijger."

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


Reply via email to