in reply to Re: Re: Hashes and Arrays
in thread Hashes and Arrays
You should probably forget about using a separate @printrows variable as you are initializing it to contain only one value anyway. Why not just use the original $newhash{ IP }?
That's supposed to be an array reference anyway.I think I might have a handle on what you are trying to do now...
my %newhash; push @{ $newhash{IP} }, [ 'row 0, col 0', 'row 0, col 1' ]; push @{ $newhash{IP} }, [ 'row 1, col 0', 'row 1, col 1' ]; # $newhash{ IP } contains a reference to an array with two elements. # Each element is itself a reference to an array with two elements. print $newhash{IP}->[0][0], "\n"; # row 0, col 0 print $newhash{IP}->[0][1], "\n"; # row 0, col 1 print $newhash{IP}->[1][0], "\n"; # row 1, col 0 print $newhash{IP}->[1][1], "\n"; # row 1, col 1
-sauoq "My two cents aren't worth a dime.";
|
|---|