On Nov 5, 2005, at 16:44, Octavian Rasnita wrote:
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.
The magic word is "cloning", called "deep cloning" sometimes when is
recursive as you want.
There are several solutions for cloning in Perl, for example the
dclone() subroutine in the standard module Storable.pm is one.
There's the Clone.pm module, and the modern Scalar::Util::Clone among
others.
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>