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

Re: Inverting a hash safely

Thread Previous | Thread Next
Ed Avis
August 4, 2009 02:45
Re: Inverting a hash safely
Message ID:
Uri Guttman <uri <at>> 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 <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About