Casey R. Tweten writes:
> Wow.  Now that, that, is lame.  You're saying that keys() expects
> it's first argument to begin with a %?  Why should it care what it's
> argumen begins with?

The keys function changes its arguments' data structure.  keys resets
the each iterator (see the documentation for these functions).

> All functions recieve their arguments in a LIST via @_.

The hash functions are prototyped as \%, meaning they are passed a
reference to the hash named as an argument.  The reference-taking:
 * permits them to change the data structures
 * is faster (one value, not all the key/value pairs)

This isn't strictly needed for keys (if you don't mind it getting
slower), but is needed for each() which maintains an iterator in the
hash.

There's also the fact that a list isn't a hash, the same way a list
isn't an array.  You are on a slippery slope that ends in:

  push( split(/,/), "foo" );

Because "push() just takes a list, right?"  (hint: wrong).

Nat

Reply via email to