Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: find acronyms in a text

by mzedeler (Pilgrim)
on Jul 23, 2009 at 12:13 UTC ( [id://782656]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://782656]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found