in reply to RE: RE: A minor epiphany with grep and map
in thread A minor epiphany with grep and map

I'm sorry, Alakaboo, you didn't understand what I wrote at all.

Given the precedence rules, @$x->{y} is not the same as @{$x->{y}}. Rather, it's the same as (@$x)->{y}. Look at the output of -Dx and -Dts if you don't believe me.

In fact, now that I try a simple test, the original code can't work:

$ perl -le '$x={y=>[1]}; print @$x->{y}' Not an ARRAY reference at -e line 1. $ perl -le '$x={y=>[1]}; print @{$x->{y}}' 1

So let's see the full code to the original, OK?

    -- Chip Salzenberg, Free-Floating Agent of Chaos

Replies are listed 'Best First'.
(No, I am an idiot, not confused) Re: The hash ref hits!
by mwp (Hermit) on Jul 28, 2000 at 23:33 UTC

    No, I understood *sigh* I'm just an idiot... I was under the impression that @$x->{y} would work and not die. I guess I gave Perl too much of a benefit of the doubt.

    My apologies Chip, it was good of you to point that out. I hope that *I* didn't come across as being snippy.

    Best regards,

    Mike