Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Need Help in Array

by Utilitarian (Vicar)
on Jan 03, 2012 at 14:36 UTC ( #946069=note: print w/replies, xml ) Need Help??


in reply to Need Help in Array

Take a look at the following:
#!/usr/bin/perl use strict; use warnings; my %modules; my $current_module; while(<DATA>){ if(/Module:\s*(\d+)/){ $current_module=$1; } else{ $modules{$current_module}{$1}=$2 if (/^(\w+)\s*:\s*(\w+)$/); } } use Data::Dumper; print Dumper(\%modules); __DATA__ Module: 1 ID:001 Customer : yes Module: 2 ID:002 Customer : no Module: 3 ID:003 Customer : yes Module: 4 ID:004 Customer : no

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://946069]
help
Chatterbox?
[shmem]: consider, then, @CBMonks as a tied variable which triggers withdrawing empty cups and serving new ones
[GotToBTru]: it's always teatime somewhere
erix the sun never sets on the CB

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2017-04-24 12:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (439 votes). Check out past polls.