Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: generating hash from array

by chester (Hermit)
on Oct 21, 2005 at 15:27 UTC ( #502045=note: print w/replies, xml ) Need Help??


in reply to generating hash from array

This relies a lot on auto-vivification:

use warnings; use strict; use Data::Dumper; my %hoh; while(<DATA>) { chomp( my @fields = split /-/, $_ ); push @{ $hoh{$fields[0]}->{$fields[1]} }, $fields[2] } print Dumper \%hoh; __DATA__ comp1-cmd1-test1 comp1-cmd1-test2 comp1-cmd2-test1 comp2-cmd1-test1 comp2-cmd1-test2 comp3-cmd1-test1

Update: added chomp

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://502045]
help
Chatterbox?
[ambrus]: Corion: I don't understand what you mean by protocol-only here. Can you explain why AnyEvent::HTTP is wrong for you? Are you a HTTP client or a server?

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2016-12-07 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.