Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: what is the function should I need to use for trim white spaces ?

by davido (Cardinal)
on Jan 11, 2006 at 19:24 UTC ( #522537=note: print w/replies, xml ) Need Help??


in reply to Re: what is the function should I need to use for trim white spaces ?
in thread what is the function should I need to use for trim white spaces ?

I thought about this too. You're correct that the /g modifier is kind of pointless by itself, but combined with the /m modifier, you get improved functionality (for some definitions of 'improved'):

use strict; use warnings; my $string = " now is the \ntime for all \n good men to co +me \n to the aid\n"; $string =~ s/^\s+//mg; $string =~ s/\s+$//mg; print $string, "\n";

Dave

  • Comment on Re^2: what is the function should I need to use for trim white spaces ?
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://522537]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2020-06-06 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (41 votes). Check out past polls.

    Notices?