in reply to Repeatable rand() and keys() for debugging
This works:
PERL_PERTURB_KEYS=0 PERL_HASH_SEED=1 perl -lE 'say for keys %{ { qw( a + 1 b 2 c 3 d 4 ) } }' c d a b
If you really insist on doing it from Perl itself, the following seems to work:
#! /usr/bin/perl use warnings; use strict; use feature qw{ say }; if (($ENV{PERL_PERTURB_KEYS} // 1) != 0 || ($ENV{PERL_HASH_SEED} // 0) + != 1) { $ENV{PERL_PERTURB_KEYS} = 0; $ENV{PERL_HASH_SEED} = 1; exec $^X, $0, @ARGV } say for keys %{ { qw( a 1 b 2 c 3 d 4 ) } }, @ARGV;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Repeatable rand() and keys() for debugging
by ibm1620 (Hermit) on Dec 09, 2022 at 19:31 UTC |