in reply to Strip leading and trailing blanks

(maybe) Not quite as efficient as the two-step method already mentioned, but this works:
$name =~ s/^\s+|\s+$//g;
Update: typo caught by Hofmator, fixed.