From:   "Philipp Knechtle" <[EMAIL PROTECTED]>
To:     <beginners@perl.org>
> I am working with subarrays in a main array. When I copy the main array:
> 
> my @mainarray = ([1,2,3],[4,5,6],[7,8,9])
> my @arraytwo = @mainarray
> 
> the references get copied. When I then modify the subarray data in
> @arraytwo they are of course also modified in @mainarray. 
> 
> So I use the command:
> 
> push @arraytwo, [EMAIL PROTECTED] for @mainarray
> 
> to copy the array. Is there a nicer way to do it?

http://search.cpan.org/search?query=Clone&mode=module

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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


Reply via email to