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.