RE: 3 dimensional hash of hashes

2007-02-22 Thread Henry Hartley
Capacio, Paula J wrote: Replace >> print "\nTest iterating over the 3 dimensional hash of hashes...\n"; >> foreach my $fileTypeKey (keys %tp3Lookup) { >> print "$fileTypeKey => \n"; >> foreach my $tpKey (keys %{$tp3Lookup{$fileTypeKey}}

Re: 3 dimensional hash of hashes

2007-02-22 Thread Andy_Bach
my $anon_ref = \%{ $tp3Lookup{$fileTypeKey}->{$tpKey} }; and use that in the now, slightly saner for loop: foreach my $anonKey ( keys %{ $anon_ref } ) { i.e. print "\nTest iterating over the 3 dimensional hash of hashes...\n"; foreach my $fileTypeKey (keys %tp3Lo

3 dimensional hash of hashes

2007-02-22 Thread Capacio, Paula J
t a 3 dimensional one. Thanks in advance, Paula Here's the scriptlet: watch out for line wraps... use strict; #2 Dimensional Hash of hashes my %tp2Lookup =( 'MNTHLY' => { #anonymous hash 'LIFEPLANS' => 'M_L_value'

RE: hash of hashes-- preserve insertion order

2003-01-17 Thread Ross Matt-QMR000
PROTECTED] Subject: RE: hash of hashes-- preserve insertion order Isn't it as easy as creating a separate @array that you push the keys into as you build the hashes? -Original Message- From: James S. Martin [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 10:46 AM To: [EM

RE: hash of hashes-- preserve insertion order

2003-01-17 Thread Peter Eisengrein
Isn't it as easy as creating a separate @array that you push the keys into as you build the hashes? -Original Message- From: James S. Martin [mailto:[EMAIL PROTECTED]] Sent: Friday, January 17, 2003 10:46 AM To: [EMAIL PROTECTED] Subject: hash of hashes-- preserve insertion orde

Re: hash of hashes-- preserve insertion order

2003-01-17 Thread michael higgins
James S. Martin wrote: I have a multi-level hash (about 4 hashes deep) and I want to keep the insertion order of the keys in which it was created. I've tried use Tie::IxHash but it doesn't seem to handle the keys in the sub-hashes. Is there a better way to do this? Thanks, {[DuhSNIP]} Sorr

Re: hash of hashes-- preserve insertion order

2003-01-17 Thread michael higgins
James S. Martin wrote: I have a multi-level hash (about 4 hashes deep) and I want to keep the insertion order of the keys in which it was created. I've tried use Tie::IxHash but it doesn't seem to handle the keys in the sub-hashes. Is there a better way to do this? [snip] I've put an arra

hash of hashes-- preserve insertion order

2003-01-17 Thread James S. Martin
I have a multi-level hash (about 4 hashes deep) and I want to keep the insertion order of the keys in which it was created. I've tried use Tie::IxHash but it doesn't seem to handle the keys in the sub-hashes. Is there a better way to do this? Thanks, James ___

RE: hash of hashes -- odd behavior

2002-09-30 Thread Patrick Connolly
Title: hash of hashes -- odd behavior Peter,   On the line:      foreach my $bucket (sort {$a <=> $b} keys %{$mttr_total{$abrv_grp}} )   You have the variable “$abrv_grp” but on the previous foreach you use the variable $group. If you change $abrv_grp to $group it shoul

RE: hash of hashes -- odd behavior

2002-09-30 Thread Peter Eisengrein
Title: RE: hash of hashes -- odd behavior That was it!!! I am using $group as a whole name and $abrv_grp as an abbreviation of $group. Sometimes its not the data that's convoluted, its the programmer. Thanks for the keen eye. Curious that this worked at all.   -Original Me

RE: hash of hashes -- odd behavior

2002-09-30 Thread Peter Eisengrein
Title: RE: hash of hashes -- odd behavior I should say, I have also printed a debug line when this bit of data is added to the hash of hashes too, and it is there. -Original Message- From: Peter Eisengrein [mailto:[EMAIL PROTECTED]] Sent: Monday, September 30, 2002 12:06 To: Perl

hash of hashes -- odd behavior

2002-09-30 Thread Peter Eisengrein
Title: hash of hashes -- odd behavior I have a hash of hashes that, at first pass, appears to be missing expected data when I try to get it via variables. However, if I call it directly (see $mttr_total{'TAC'}{'2'} in debug line below) I get the data. What gives? Th

Re: Fw: Hash of Hashes

2002-05-07 Thread Simon Oliver
[EMAIL PROTECTED] wrote: > $Bill got your $ vs \% problem, but just FYI. In general it is not safe > to store a list of references from DBI methods, many (soon to be all) of > them recycle the ref, so you could end up with an array or hash of > identical refs. So store a copy of the data referen

Re: Fw: Hash of Hashes

2002-05-07 Thread shurst
> Thanks for the reply. I have included the result set and some more of the > code. Your help is appreciated. > > > my $dbh = DBI->connect("DBI:XBase:C:/Perl/progs/customer") or die > $DBI::errstr; > my $sth = $dbh->prepare("select ID, First_Name from customer") or die > $dbh->errstr(); >

Re: Hash of Hashes

2002-05-07 Thread Lee Goddard
At 09:03 07/05/2002 +0100, Simon Oliver wrote: >Lee Goddard wrote: > > $i_ama_hash_ref->{ima_key2}->{"I'm a value")="I'm a key"; > >You swapped a brace with a bracket and didn't you mean this anyway: > >$i_ama_hash_ref->{ima_key2}->{"I'm a key"}="I'm a value"; Sure did. That'll teach me to try an

Re: Hash of Hashes

2002-05-07 Thread Simon Oliver
Lee Goddard wrote: > $i_ama_hash_ref->{ima_key2}->{"I'm a value")="I'm a key"; You swapped a brace with a bracket and didn't you mean this anyway: $i_ama_hash_ref->{ima_key2}->{"I'm a key"}="I'm a value"; and don't forget, when it get's multidimensional you can drop the -> notation so it looks

Re: Hash of Hashes

2002-05-07 Thread Lee Goddard
At 22:17 06/05/2002 -0700, Kevin wrote: >I am reading a DBI record into a hash reference - my $row = >$sth->fetchrow_hashref() - I would like to create a hash to hold all of the >returned rows (or thus, hashes) with the ID being the key, so for example > >$returned_rows{$row->{'ID'}} = $row $I_am

Re: Fw: Hash of Hashes

2002-05-06 Thread $Bill Luebkert
Kevin wrote: > > Thanks for the reply. I have included the result set and some more of the > code. Your help is appreciated. > > > my $dbh = DBI->connect("DBI:XBase:C:/Perl/progs/customer") or die > $DBI::errstr; > my $sth = $dbh->prepare("select ID, First_Name from customer") or die > $dbh->er

Fw: Hash of Hashes

2002-05-06 Thread Kevin
reference - my $row = > > $sth->fetchrow_hashref() - I would like to create a hash to hold all of the > > returned rows (or thus, hashes) with the ID being the key, so for example > > > > $returned_rows{$row->{'ID'}} = $row > > > > Essentially I wou

Re: Hash-of-hashes problem testing whether keys have values

2001-06-02 Thread Ian Taite
Thanks Ron, I've tried your recommendation on another piece of test code and it works the way I want. I guess the autovivication thing in this context can be regarded as just another Perl feature, for now at least. Regards, Ian. >From: "Ron" <[EMAIL PROTECTED]> >

Re: Hash-of-hashes problem testing whether keys have values

2001-06-02 Thread Ron
{'Key3'} ) {...} >From the docs: "This surprising autovivification in what does not at first--or even second--glance appear to be an lvalue context may be fixed in a future release." - Original Message - From: "Ian Taite" <[EMAIL PROTECT

RE: hash of..hashes...

2000-10-31 Thread erskine, michael
> -Original Message- > From: bruno stefanutti [mailto:[EMAIL PROTECTED]] > Sent: 31 October 2000 14:19 > To: '[EMAIL PROTECTED]' > Subject: hash of..hashes... See this excellent article, "Understand References Today - © Copyright 1998 The Perl Journal.&q

RE: hash of..hashes...

2000-10-31 Thread Martin Moss
What you describe there is a list of hashes   my @mother=();   $mother[1]=%hash $mother[2]=%hash2   however a hash of hashes is possible. %hash1=(name=>'fred'); %hash2=(name=>'bill');   %mother_of_hashes=();   $mother_of_hashes{myhash}=%hash1; $mother_of_hashe