|
|
| Pathologically Eclectic Rubbish Lister | |
| PerlMonks |
Answer: How do I remove whitespace at the beginning or end of my string? |
| ( #168633=categorized answer: print w/ replies, xml ) | Need Help?? |
|
Q&A > regular expressions > How do I remove whitespace at the beginning or end of my string? contributed by Bobinours
I read somewhere (probably in the CookBook) that it's faster to execute this :
Than the one-liner : $string =~ s/^\s+|\s+$//g;
Edited by davido: Removed useless use of /g modifier from the two-line (faster) example.
|
|
||||||||||||||||||||