http://qs1969.pair.com?node_id=294343

s_mile has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

Is there a "smart way" :) to remove both the leading and trailing spaces in a string?
One way I know is as below:

$val=" Smart Way "; $val=~s/^\s+//; $val=~s/\s+$//; print '>'.$val.'<'; # shld give me >Smart Way<
Is there a way to do the same in just one statement?

'Ask and ye shall recieve. Seek and ye shall find'.

Blessings

s_mile

update (broquaint): tidied up formatting + removed <br> tags from <code> tags