in reply to find acronyms in a text

When using split, write split /\s+/ in stead of split /\s/. Otherwise you'll get undef values every time there is two consecutive white space chars.

print join(', ', split /\s/, "just three words"), "\n"; print join(', ', split /\s+/, "just three words"), "\n";

Replies are listed 'Best First'.
Re^2: find acronyms in a text
by Anonymous Monk on Jul 23, 2009 at 14:15 UTC
    Better yet, specify a literal space " " (or nothing at all and it will default to the same thing) to split on any length whitespace AND skip leading whitespace. Your patterns have the potential to return initial null fields. -Greg