in reply to Re: Finding Previous and Next in a HASH
in thread Finding Previous and Next in a HASH
You can get away with $keys[$index-1] and
$keys[($index+1) % @keys] because the first
array access, should it be negative, will access from the
back of the array, and the last array access is guaranteed
to be in range. So no extra checking is needed for boundaries.
-Ted
-Ted
|
---|
In Section
Seekers of Perl Wisdom