in reply to Strip leading and trailing blanks

TIMTOWTDI :)

I've always been fond of this, which also compresses "extra" spaces in the middle to a single space:

$name = join ' ', split ' ', $name;
It's not all that much slower than the others, and if you want to compress the internal whitespace it's hard to beat. Lots of my proggies have a little sub:
sub wsp { $_ = shift; join ' ', split; }
which takes advantage (in terseness, not speed) of the magic of $_ and split's default behavior.