Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Having trouble loading a hash with map

by thundergnat (Deacon)
on May 03, 2012 at 14:34 UTC ( #968756=note: print w/ replies, xml ) Need Help??


in reply to Having trouble loading a hash with map

It is because you are only applying the map to the first line of the file. Try:

use strict; use Data::Dumper; my %hash; %hash = map {map { chomp; $_ => '1' } split /(\s+|\W+)/} <DATA>; print Dumper(\%hash); __DATA__ LOW-RES PDF NOT PRINT-READY MY BIG TOE BOOK 1: A WAKENING Section 1 Delusion or Knowledge: Is This Guy Nuts, or What? Section 2 Mysticism Demystified The Foundations of Reality LOW-RES PDF NOT PRINT-READY The My Big TOE reality model will help you understand your life, your purpose,


Comment on Re: Having trouble loading a hash with map
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2015-07-28 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls