⭐ in reply to How do I remove whitespace at the beginning or end of my string?
use Regexp::Common qw/whitespace/; $foo =~ s/$RE{ws}{crop}//g; [download]