⭐ in reply to How do I remove whitespace at the beginning or end of my string?
I read somewhere (probably in the CookBook) that it's faster to execute this :
$string =~ s/^\s+|\s+$//g;
Than the one-liner :$string=~s/^\s+//; $string=~s/\s+$//;
$string =~ s/^\s+|\s+$//g;
Edited by davido: Removed useless use of /g modifier from the two-line (faster) example.
In Section
Seekers of Perl Wisdom