|
|
| Don't ask to ask, just ask | |
| PerlMonks |
Answer: How do I remove whitespace at the beginning or end of my string? |
| ( #79952=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 Daddio
Similarly to infinityandbeyond, you could substitute out the leading and trailing white space like this. $string =~ s/^\s*(.*?)\s*$/$1/;
|
|
||||||||||||||||||