in reply to Fast(er) serialization in Perl
Like others, I think there is almost certainly a better, (more space efficient and faster to load), method of storing your data, that would be equally if not more efficient for performing your lookups and require minimal changes to your script.
The key to transforming your hashes to that form, is more details about the nature of the data. If you were to run this script against your hash structure--fill in the name of your Storable file and redirect the output to another file--and post the output, you might get suggestions for how to perform that transformation:
#! perl -slw use strict; use List::Util qw[ max minstr maxstr ]; use Storable qw[ retrieve ]; my $h = retrieve '/path/to/yourfile'; for my $l1 ( keys %{ $h } ) { for my $l2 ( keys %{ $h->{ $l1 } } ) { printf "$l1->$l2: N: %d minL3: %s maxL3: %s minVal: %d\n", scalar( keys %{ $h->{ $l1 }{ $l2 } } ), minstr( keys %{ $h->{ $l1 }{ $l2 } } ), maxstr( keys %{ $h->{ $l1 }{ $l2 } } ), max( values %{ $h->{ $l1 }{ $l2 } } ); } }
|
|---|