How do Perl FIRSTKEY and NEXTKEY work

Posted by mmccoo on Stack Overflow See other posts from Stack Overflow or by mmccoo
Published on 2010-06-09T23:33:43Z Indexed on 2010/06/09 23:42 UTC
Read the original article Hit count: 160

Filed under:

Tie::Hash has these:

sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} }
sub NEXTKEY  { each %{$_[0]} }

NEXTKEY takes two arguments, one of which is the last key but that arg is never referenced?

The various Tie docs don't shed any light on this other than this in perltie:

my $a = keys %{$self->{LIST}};      # reset each() iterator

looking at the doc for each doesn't add to this.

What's going on?

© Stack Overflow or respective owner

Related posts about perl