Re: Sorted Hash
- From: xhoster@xxxxxxxxx
- Date: 30 Nov 2007 05:27:41 GMT
"palexvs@xxxxxxxxx" <palexvs@xxxxxxxxx> wrote:
I filled hash and then printed it (sorted by key):
my %hs = (
key10 => 5,
key5 => b,
aey9 => 7,
)
foreach my $k (sort keys %hs) { print "$k $hs{$k}\n"; }
key - string ([0-9A-F]{72}), 50K records.
How do it more effective?
What is ineffective about the current way?
You could keep the structure sorted throughout its lifetime by using
a tied hash or a non-hash structure, but the overhead of doing so
is almost certainly going to be greater than a one-time sort.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
.
- Follow-Ups:
- Re: Sorted Hash
- From: bugbear
- Re: Sorted Hash
- References:
- Sorted Hash
- From: palexvs@xxxxxxxxx
- Sorted Hash
- Prev by Date: Re: Perl reference, what's the difference
- Next by Date: FAQ 4.17 How do I find yesterday's date?
- Previous by thread: Re: Sorted Hash
- Next by thread: Re: Sorted Hash
- Index(es):
Relevant Pages
|
|