in reply to building a hash of hashes with constant keys
use strict; use Data::Dumper; my @countries=('Argentina', 'Algeria', 'Belgium'); my %HoH; while (<DATA>) { my ($period, @values)=split; my %temphash; $temphash{$countries[$_]}=$values[$_] for (0..scalar @countries -1); $HoH{$period}=\%temphash; } print Dumper(\%HoH); __DATA__ Q4_2001 1 2 3 Q1_2002 4 5 6
CU
Robartes-
Update: Replaced qw// style quoting. See Zaxo's reply below as to why. Good catch, Zaxo!
|
|---|