|There's more than one way to do things|
Comment onby gods
|on Feb 11, 2000 at 00:06 UTC||Need Help??|
map aliases $_ to each item in turn in the list it is dealing with. If you edit $_ in the map the original list items are edited. This can be an unwanted and nasty side effect. Note that aliasing in exactly the same way happens in Perl for loops.
Your clean sub doesn't return the cleaned string. It edits the passed in string in place (Perl essentially passes aliases of parameters into subs). Because the doesn't return the cleaned string you need to "return" the edited string from map, hence the '; $_;' bit in the map.
In this case a cleaner solution is to trim the white space in the split:
True laziness is hard work
In reply to Re^2: How to call a function on each item after a split?