develooper Front page | perl.beginners | Postings from August 2009

Re: Inverting a hash safely

Thread Previous | Thread Next
From:
Ed Avis
Date:
August 4, 2009 02:45
Subject:
Re: Inverting a hash safely
Message ID:
loom.20090804T094000-114@post.gmane.org
Uri Guttman <uri <at> stemsystems.com> writes:

>  EA>     foreach my $k (sort keys %hash) {
> 
>why the sort?

No terribly good reason; I just wanted the error messages to be deterministic.
You could speed it up a bit by not sorting and it would still work just as well,
but the error message given might in theory differ from one run to the next or
between different perl interpreters.

-- 
Ed Avis <eda@waniasset.com>


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About