Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Can I change the definition of '\s'?

by mephit (Scribe)
on Sep 11, 2002 at 20:38 UTC ( [id://197070]=note: print w/replies, xml ) Need Help??


in reply to Can I change the definition of '\s'?

As perlman:perlfaq4 says, is would be better to remove leading and trailing whitespace with two steps, not one:
for ($string) { s/^\s+//; s/\s+$//; }

So, I'd suggest doing it with two separate supstitutions and the custom-character-class-as-a-string that davorg and John M. Dlugosz suggested. HTH

--

There are 10 kinds of people -- those that understand binary, and those that don't.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-03-29 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found