in reply to Re: list vs array context: odd error message...
in thread list vs array context: odd error message...

So does my inital reponse not accomplish the same thing in another way? I didn't test it, but if memory serves, its effect is identical.

Hot Pastrami
  • Comment on Re: Re: list vs array context: odd error message...

Replies are listed 'Best First'.
Re: Re: Re: list vs array context: odd error message...
by merlyn (Sage) on Dec 16, 2000 at 04:50 UTC
    It's not identical if there's already something in the hash element. It reuses any existing hashref pointer, and may even fail if there's an arrayref or something else there instead.

    That's why I prefer avoiding the @{$foo[bar]} = ... forms, opting instead for the $foo[bar] = [...] forms as being much safer.

    -- Randal L. Schwartz, Perl hacker

      Oh yes, I see. Thanks.

      Hot Pastrami
Re: Re: Re: list vs array context: odd error message...
by swiftone (Curate) on Dec 16, 2000 at 04:51 UTC
    It does indeed accomplish the same thing, but it obfuscates what you're doing. (You dereference your lvalue, while I make a references of the rvalue). As proof, I wasn't sure your way worked until I tested it. :)

    To each his own.