The_Dj has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Monks.
For reasons probably best described as DBI, I have data like this:
%dat_by_id = ( 1=>{ id=>1, sn=>'a', more=>'foo' }, 2=>{ id=>2, sn=>'b', more=>'bar' } );
You get the idea.
Now, for reasons best described as argh! I also do:
%dat_by_sn=(map { $_->{sn} => $_ } values %dat_by_id);Sadly I do need to reference entries be either field throughout the rest of the code.
Is there a better way? (My dataset runs to a few million records. Big but not too big.)
I don't (currently) need a 3rd,4th,...nth field, but it's only a matter of tiem untill someone adds a UID field, or something else to compicate my life
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Too Many IDs
by kcott (Archbishop) on Jan 09, 2020 at 08:21 UTC | |
by The_Dj (Scribe) on Jan 09, 2020 at 13:49 UTC | |
by kcott (Archbishop) on Jan 10, 2020 at 01:58 UTC | |
by Anonymous Monk on Jan 13, 2020 at 01:06 UTC | |
Re: Too Many IDs
by choroba (Cardinal) on Jan 09, 2020 at 08:08 UTC | |
by LanX (Saint) on Jan 09, 2020 at 11:30 UTC | |
Re: Too Many IDs
by LanX (Saint) on Jan 09, 2020 at 11:34 UTC | |
by ForgotPasswordAgain (Vicar) on Jan 09, 2020 at 13:36 UTC | |
by The_Dj (Scribe) on Jan 09, 2020 at 13:53 UTC | |
by Tanktalus (Canon) on Jan 09, 2020 at 20:42 UTC | |
by talexb (Chancellor) on Jan 10, 2020 at 18:51 UTC | |
by Anonymous Monk on Jan 13, 2020 at 01:34 UTC | |
| |
by LanX (Saint) on Jan 09, 2020 at 16:25 UTC |