"... this will ensure you always have the same order: my @keys = keys %test;"
Actually, that's only true for versions of Perl prior to 5.18.0. From perl5180delta: Hash overhaul:
"By default, two distinct hash variables with identical keys and values may now provide their contents in a different order where it was previously identical."
I have v5.18.1 - here's a few example runs:
$ perl -Mstrict -Mwarnings -E 'my %x = map { $_ => 1 } "A" .. "E"; my +@y = keys %x; say "@y"' A D E C B $ perl -Mstrict -Mwarnings -E 'my %x = map { $_ => 1 } "A" .. "E"; my +@y = keys %x; say "@y"' D E C B A $ perl -Mstrict -Mwarnings -E 'my %x = map { $_ => 1 } "A" .. "E"; my +@y = keys %x; say "@y"' D E B A C
Either a sort on the keys, or even a hard-coded list, would probably provide a more robust solution.
-- Ken
In reply to Re^2: DBI and mysql query formatting
by kcott
in thread DBI and mysql query formatting
by kimlid2810
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |