There is no information in a hash with index values that isn't in an array.
Yes and no. If you want to know "the position of a given number", the information is there in the array, but finding it is hard (O(N)). It's O(1) with a hash.
my ($index) = grep $code[$_] == $x, 0..$#code; -vs- my $index = $code{$x};
In reply to Re^4: Convert a string into a hash
by ikegami
in thread Convert a string into a hash
by vitoco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |