Hi,
I have tried the following test program:
my @array = (
{a => 'aaa', b => 'bbb',},
{a => 'ala', b => 'bala',},
);
my @array2 = @array;
$array2[0]{a} = 'nanan';
push(@array2, 'test');
use Data::Dumper;
print Dumper [EMAIL PROTECTED];
The result was:
$VAR1 = [
{
'a' => 'nanan',
'b' => 'bbb'
},
{
'a' => 'ala',
'b' => 'bala'
}
];
I know why modifying an element from a hashref from the second array
modifies that element in the first array and why the new pushed element in
the second array is not shown in the first array, but I don't know how to
create a second array with all the elements of the first one, but totally
separately.
Is this possible somehow, or I will need to use foreach element of the first
array, and create the correspondent element in the second one?
The array doesn't have more levels, so I would like avoiding using a CPAN
module that can copy an entire data structure.
Thank you.
Teddy
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>