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 order I hav

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

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 should work.  

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

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: 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
Defined/Exists is NOT the issue here. To paraphrase 'exists' entry in Camel 3 (but not Camel 2 or online docs): When you say... if(defined (((or exists $Hash{'Key1'}->{'Key2'} {'Key3'}){... ... Perl autovivifies the hash references $Hash{'Key1'} and $Hash{'Key1'}->{'Key2'}. You need to sa

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."... http://www.plover.com/~mjd/per

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_hashes{yourhash}=%hash2;   Thus   $name