in reply to need to consolidate two lines to one

(my $string = 'hello') =~ /^\s+|\s$/g;

EDIT:

Err, I guess that doesn't really do much... I think this does what you want:

(my $foo = '  doo de doo  ') =~ s/^\s+(.+?)\s+$/$1/;

EDIT 2:

I think this more closely matches what you are looking for:

(my $foo = '  doo de doo  ') =~ s/^\s+|\s+$//g;