$_ = ' blee blah '; s/\s*(.*?)\s*/$1/; print "matched '$&'; retained '$1'; str is '$_'\n";