Then please, implement a benchmark that exhibits the savings you are concerned about.
#! perl -slw use strict; use Benchmark qw[ cmpthese ]; our %hash = 'aaaaa' .. 'dzzzz'; cmpthese 1, { a => q[ my @keys = keys %hash; my @vals = values %hash; my $x; $x = "$keys[ $_ ] :: $vals[ $_ ]" for 0 .. $#keys; ], b => q[ my( $k, $v, $x ); $x = "$k :: $v" while ( $k, $v ) = each %hash; ] }; __END__ s/iter a b a 3.06 -- -41% b 1.79 70% --
In reply to Re^7: keys and values order on a hash
by BrowserUk
in thread keys and values order on a hash
by citromatik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |