Is there a way to do this in one line?
$x =~ s/^\\s+//; $x =~ s/\\s+$//;
In other words, remove all leading and trailing whitespace from a stri
I usually do it like this:
($foo) = $foo =~ /^\s*(.*?)\s*$/;
Everything between the leading spaces and the trailing spaces is grouped and returned, so I can assign it to the same old variable.