Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Help with multi-dimensional arrays (list of lists)

by atemon (Chaplain)
on Nov 26, 2007 at 16:03 UTC ( [id://653016]=note: print w/replies, xml ) Need Help??


in reply to Help with multi-dimensional arrays (list of lists)

Hi,

in your code,

push @biu_yz, [ @biu_z ];
or similar pushes, you are pushing the reference. i.e. the operator [ ] will create an array, with same contents as that of @biu_z and return a reference to the new array. (see Anonymous Arrays)
When you try to access the value by
$biu[$i][4][$k] = $u25;
you need to use '->' operator to derefer it. try
$biu->[$i][4][$k] = $u25;

Cheers !

--VC

My Home

Replies are listed 'Best First'.
Re^2: Help with multi-dimensional arrays (list of lists)
by ikegami (Patriarch) on Nov 26, 2007 at 16:28 UTC

    Sorry, but that's completely off base.

    The elements of @biu contain references, so you could do

    $biu[$i]->[4]->[$k]

    but -> is optional between indexes, so the following are all fine

    $biu[$i]->[4]->[$k] $biu[$i]->[4][$k] $biu[$i][4]->[$k] $biu[$i][4][$k]

    $biu->[$i][4][$k] dereferences the reference in $biu, but there's no such variable in the program.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-03-28 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found