Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Parsing individual words from a file

by Hue-Bond (Priest)
on Oct 08, 2006 at 17:48 UTC ( [id://577013]=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing individual words from a file
in thread Parsing individual words from a file

my @w = map /\S+/, <DATA>; use Data::Dumper;print Dumper \@w; __DATA__ aboveboard aboveground abovementioned abrade Abraham Abram Abramson abrasion abrasive abreact abreast abridge abridgment abroad

Produces:

$VAR1 = [ 1, 1 ];

Test your code the next time ;^). You really meant /\S+/g:

my @w = map /\S+/g, <DATA>; use Data::Dumper;print Dumper \@w; __DATA__ aboveboard aboveground abovementioned abrade Abraham Abram Abramson abrasion abrasive abreact abreast abridge abridgment abroad
$VAR1 = [ 'aboveboard', 'aboveground', 'abovementioned', [...]

--
David Serrano

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found