in reply to Re (tilly) 2: Whether to use local()
in thread Whether to use local()

I know about local on hash elements and array elements but thought it would complicate the explanation for him. Just like I omitted PadWalker from the explanation of accessing lexicals. Point taken though. Was local on hash/array elements added as a hack for signal handlers? It seems the only real use that I've seen. Or is it used internally when you localize a package var in the symbol table seeing a package is in a sense a hash?

-Lee

"To be civilized is to deny one's nature."
  • Comment on Re: Re (tilly) 2: Whether to use local()

Replies are listed 'Best First'.
Re: Re: Re (tilly) 2: Whether to use local()
by oubiwann (Sexton) on Mar 17, 2002 at 03:17 UTC
    Was local on hash/array elements added as a hack for signal handlers?

    local was added to perl when there were only global variables as a hack for providing a means of creating "local" variables. There are other uses for it though, but that is better said here: Seven Useful Uses of local

      I guess what I find odd about it working on pieces of arrays and hashes is why bother? I mean if it can do a chunk of a lexical hash, why not a whole hash? I can't imagine why the half implementation. I'm sure there was a good reason, but I can't imagine what it is.

      -Lee

      "To be civilized is to deny one's nature."