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

Re: The Drivel is in the Details

by jZed (Prior)
on May 29, 2007 at 22:24 UTC ( #618069=note: print w/replies, xml ) Need Help??

in reply to The Drivel is in the Details

$source is a reference to a hash. You find the keys by de-referencing it (%$source) then you dereference it with the arrow in $source->{node}. You could use the format you are used to if you do something like:
my %newSource = %$source; # dereference it all at once foreach my $node(keys (%newSource)) { # note no %$ #... $newSource{$node}; # already dereferenced.

update I'm not recommending that you change the code, but showing a similar situation to explain the code. If you are thinking of changing the code, see the important caveat mentioned by Random_Walk.

Replies are listed 'Best First'.
Re^2: The Drivel is in the Details
by Anonymous Monk on May 29, 2007 at 22:28 UTC
    Thank you - I think I can explain it from there.

Re^2: The Drivel is in the Details
by Random_Walk (Prior) on May 30, 2007 at 22:48 UTC

    I think you should point out that when you do

    my %newSource = %$source; # dereference it all at once
    you are not just dereferencing $source but making a new and independent copy in %newSource. This may have implications if the code evolves. Any change made to one array will not be reflected in the other, for instance an element removed from %$source is not removed from %newSource and the removal of $source will not imply removal of %newSource


    Pereant, qui ante nos nostra dixerunt!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://618069]
[MidLifeXis]: I have a user who has a lot of say on how some of our processes work that abhors significant blanks. Perhaps that is a part of it. A not-so-obvious "this space intentionally left blank" indicator.
[MidLifeXis]: On the back end, however, that doesn't mean that i have to use that value to indicate "undefined", no matter how much he thinks I should.
[stonecolddevin]: hey MidLifeXis, all
[MidLifeXis]: o/
[GotToBTru]: greets

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-01-20 19:18 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (176 votes). Check out past polls.