http://www.perlmonks.org?node_id=46580

This isn't a JAPH. It's an obfuscation that's actually useful. (And yes, it's really an obfuscation. I don't know of any other way to accomplish this.)

What does it do? It manufactures an object that can be used as either an array reference or a hash reference.

Why would you ever want such a thing? Well, it's the natural way to present an ordered hash. You could then use $orderedhash->[7] to get item number seven, or $orderedhash->{key} to get the item with the specified key.

Or for example you could have an object that represents a directory. $dir->[3] gets the name of file number 3 from the directory, so it is easy to iterate over the files in the directory, and $dir->{name} gets the stat information for the file named name. (The test.pl file supplied with the module has a demonstration of how to do this.)

Since it was actually useful, I put it on CPAN. Visit search.cpan.org and search for ArrayHashMonster, or just download it now.

Of course, figuring out how it works is left as an exercise. Don't post spoilers here.