in reply to Hashes of hashes
Result:use strict; use Data::Dumper; my %hoh; while(<DATA>){ my $line=$_; chomp($line); my @values=split(/,/,$line); my @type_val=splice(@values,3,2); my $ref_a=\@type_val; my ($type_value,$key_type)=split(/\./,$values[2]); push(@{$hoh{$key_type}},$type_value); #works fine push(@{$hoh{$key_type}},{$type_value},$ref_a); #Does NOT WORK } print Dumper(\%hoh); __DATA__ abc,def,excel1.xls,12,some,time hj,uyi,excel2.xls,12,more,time2
$VAR1 = { '' => [ undef, { '' => undef }, [] ], 'xls' => [ 'excel1', { 'excel1' => undef }, [ '12', 'some' ], 'excel2', { 'excel2' => undef }, [ '12', 'more' ] ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hashes of hashes
by Anonymous Monk on Jan 15, 2007 at 10:48 UTC | |
by wfsp (Abbot) on Jan 15, 2007 at 11:01 UTC | |
by Anonymous Monk on Jan 15, 2007 at 11:08 UTC |