Prototype changes across Perl release boundaries

At a previous employer, one of the things I ran into from time to time was the need to get the keys of a hash back out in the same order they were provided. Yes, Tie::IxHash exists to solve this problem: but it always felt like a heavy-weight solution to a simple problem. Why bother adding a new dependency to the system when I could just swap my %hash out for a @hashlike array?


    my @hashlike = (1..10);    # generally the return value of a subroutine

while (my ($k, $v) = splice @hashlike, 0, 2) {
... # do something with $k, $v
}