in reply to Re: Basic Perl Regular Expressions
in thread Basic Perl Regular Expressions

You might want to split on /\s+/ to be more robust. This will match white space of more than one character.

You could also split on /\b/ and then grep for word characters if you wanted a slightly different definition of a word. This would split words with hyphons and apostorphes which might or might not be what you want.

@words = grep (/\w/, split (/\b/, $foo));

-monkfish (The Fishy Monk)