Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

The hash ref hits!--more--You are confused

by chip (Curate)
on Jul 28, 2000 at 23:09 UTC ( #24977=note: print w/replies, xml ) Need Help??

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,


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://24977]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2021-06-23 11:58 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (118 votes). Check out past polls.