hoelzro has asked for the wisdom of the Perl Monks concerning the following question:
So when I call keys on a tied hash of this variety, it returns (), as expected. But if I wanted to, how would I return an undef value without ending the keys list?# TestHash.pm use strict; use warnings; package TestHash; sub TIEHASH { return bless [], $_[0]; } sub FIRSTKEY { return undef; } sub NEXTKEY { my ($this, $last) = @_; return $last >= 10 ? undef : $last + 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tying hashes with undef keys
by ysth (Canon) on Jul 09, 2007 at 01:43 UTC | |
|
Re: Tying hashes with undef keys
by wind (Priest) on Jul 09, 2007 at 04:19 UTC |