in reply to Empty strings after split /(\W)/
What is your expected output? Is it what you're showing in your second and third example?
Regarding grep {$_} ...: that will also filter out the string "0", since that's false in Perl. You may find grep {length} ... better.
However, personally, I like your third example best, because I feel like it expresses best what you want the output to be, but of course There's More Than One Way To Do It :-)
|
|---|