Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Array of Arrays: why is "$VAR1->[0][1]" and the like embedded within?

by NetWallah (Canon)
on Jun 11, 2018 at 04:24 UTC ( [id://1216366]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Array of Arrays: why is "$VAR1->[0][1]" and the like embedded within?
in thread Array of Arrays: why is "$VAR1->[0][1]" and the like embedded within?

or .. it may be easier to dump the elements of the output:
print Dumper $_ for @{ increment(increment(\@a)) }; # Output: [ [ 1, 2 ], [ 2, 3 ] ] [ [ 2, 3 ], [ 3, 4 ] ] [ [ 3, 4 ], [ 4, 6 ] ]

                Memory fault   --   brain fried

  • Comment on Re^3: Array of Arrays: why is "$VAR1->[0][1]" and the like embedded within?
  • Download Code

Replies are listed 'Best First'.
Re^4: Array of Arrays: why is "$VAR1->[0][1]" and the like embedded within?
by Athanasius (Archbishop) on Jun 11, 2018 at 05:41 UTC

    Sure, that gives a better view of the contents of the data structure. But it doesn’t show that the second occurrence of the anonymous array [ 2, 3 ] has the same address as (= is the same anonymous array as) the first — which is what I was intending to demonstrate.

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      But, it helps me see the relationship through the code --> pulling the values from the reference. This, and your visualization, are helping me look at how to manipulate the references to my needs, even when I'm still having trouble understanding the underlying issue.
      $state{tired}?sleep(40):eat($food);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-20 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found