in reply to Re: accessing element of array of arrays
in thread accessing element of array of arrays
Notice that when $AoA2[0][0] is augmented, $AoA1[0][0] is as well. The desired output would be:#!/usr/bin/perl use strict; use warnings; my @AoA1 = ([1, 'a'], [2, 'b']); my @AoA2; push @AoA2, @AoA1; $AoA2[0][0] = $AoA1[0][0]; print "$AoA1[0][0], $AoA2[0][0]\n"; $AoA2[0][0] ++; print "$AoA1[0][0], $AoA2[0][0]\n";
instead of1, 1 2, 1
.1, 1 2, 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: accessing element of array of arrays
by FunkyMonk (Bishop) on Jul 06, 2008 at 08:58 UTC |