http://www.perlmonks.org?node_id=250912


in reply to How do I remove whitespace at the beginning or end of my string?

Regex::Common is also a good choice.
use Regexp::Common qw/whitespace/; $foo =~ s/$RE{ws}{crop}//g;
  • Comment on Re: How do I remove whitespace at the beginning or end of my string?
  • Download Code