in reply to Re^2: Hashes of hashes
in thread Hashes of hashes

You were nearly there!
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hoh; while(<DATA>){ my $line=$_; chomp($line); my @values=split(/,/,$line); my @type_val=splice(@values,3,2); my ($type_value,$key_type)=split(/\./,$values[2]); $hoh{$key_type}{$type_value} = [@type_val]; } print Dumper \%hoh; __DATA__ abc,def,excel1.xls,12,some,time hj,uyi,excel2.xls,12,more,time2
output:
---------- Capture Output ---------- > "c:\perl\bin\perl.exe" _new.pl $VAR1 = { 'xls' => { 'excel2' => [ '12', 'more' ], 'excel1' => [ '12', 'some' ] } }; > Terminated with exit code 0.

Replies are listed 'Best First'.
Re^4: Hashes of hashes
by Anonymous Monk on Jan 15, 2007 at 11:08 UTC
  • COOL !! Thanks so much
  • yea..Works