in reply to Dereferencing of data
Yes, you can copy arrays as you have done, and yes, it will work for AoA and AoH, but, as indicated by other posters, this is not very efficient. Why not use and pass the Array ref itself ? The only down-side is the de-referencing syntax:my $arrayref = [1,2,3,4,5,6,7,8]; # Note: SQUARE brackets
but you get accustomed to that pretty soon.my $third_element = $arrayref->[2];
Once you get past the reference-passing phobia, your programs become cleaner and more efficient.
perldoc perlref is your friend.
|
|---|