in reply to Array skips number if checked for defined.

Hello $h4X4_|=73}{,

To expand a little on hippo’s answer: If you print out the contents of @Foo::THING immediately after the statement beginning Foo::check_THING(1), you’ll see an additional, empty, anonymous hash has been autovivified by the action of referring to $THING[1]{check}1:

0:20 >perl 1665_SoPW.pl Some Thing No Thing [{ check => 1 }, {}] No Thing Some Thing 0:20 >

(I’m using Data::Dump.) And if you add this line:

no autovivification;

immediately before the line our @THING = ();, you’ll get the behaviour you expect:

0:20 >perl 1665_SoPW.pl Some Thing No Thing [{ check => 1 }] Some Thing No Thing 0:24 >

(See the autovivification pragma.)

1Note that you can replace check with any key name here and get the same result.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,