in reply to How to check if a string contains more than 1 character?

I liked the other responses. Here's another.
perl -e '$str = q|abc|; $str2=q|a|; for($str,$str2){m/\S{2,}/ && prin +t qq|$_|};'

Celebrate Intellectual Diversity

Replies are listed 'Best First'.
Re^2: How to check if a string contains more than 1 character?
by Lotus1 (Vicar) on May 02, 2013 at 18:04 UTC

    You can also put a list of strings directly in the foreach loop.

    perl -e "foreach(qw(abc a 00)){print qq($_\n) if m/\S{2,}/}"