Octavian Rasnita am Samstag, 5. November 2005 16.44:
> Hi,

Hi

> I have tried the following test program:
>
> my @array = (
> {a => 'aaa', b => 'bbb',},
> {a => 'ala', b => 'bala',},
> );
>
> my @array2 = @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.

For example (tested):

my @array2=map { {%$_} } @array;

# of course does not work with more levels

joe

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to