Don't ask to ask, just ask | |
PerlMonks |
Re^2: trimming space from both sides of a stringby GrandFather (Saint) |
on Oct 16, 2010 at 06:20 UTC ( [id://865631]=note: print w/replies, xml ) | Need Help?? |
It seems likely (without benchmarking) that those two substitutions (s/^\s.*//; s/\s.*$//;) are very efficient at removing leading and trailing white space. However the side effect of removing everything if there is leading or trailing white space may be too much of a price to pay for "efficiency"!
True laziness is hard work
In Section
Meditations
|
|