in reply to Perl hashes and non-determinism
You can use something that looks like a hash, but provides ordered results: Tie::IxHash
$ demo() { perl -e' use v5.18; use Tie::IxHash qw( ); my %h; tie %h, Tie::IxHash:: if $ARGV[0]; ++$h{ $_ } for "a".."z"; say keys %h; ' -- "$1" } $ demo 0 lukphmweqsiorxvnbdfajyczgt $ demo 0 dpbwuxlvticosyngmrzajefqkh $ demo 1 abcdefghijklmnopqrstuvwxyz $ demo 1 abcdefghijklmnopqrstuvwxyz
You'd have to tie not just %hash, but the hashes referenced by the values of %hash.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl hashes and non-determinism
by NERDVANA (Priest) on Nov 21, 2025 at 04:24 UTC |