Is there a "smart way" :) to remove both the leading and trailing spaces in a string?
One way I know is as below:
Is there a way to do the same in just one statement?$val=" Smart Way "; $val=~s/^\s+//; $val=~s/\s+$//; print '>'.$val.'<'; # shld give me >Smart Way<
'Ask and ye shall recieve. Seek and ye shall find'.
Blessings
s_mile
update (broquaint): tidied up formatting + removed <br> tags from <code> tags
In reply to remove both leading and trailing spaces by s_mile
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |