that will only copy a shallow hash. that is, one that does not
contain references to other hashes or arrays. if you want to
copy all elements (a deep copy), here is a suggestion:
use Storable qw(freeze thaw);
%arr1=qw(key1 data1 key2 data2);
$arr1{key3}=[qw(arrdata1 arrdata2)];
%arr2=%{thaw freeze \%arr1};
now all the elements of %arr1 are copies into %arr2. %arr2 has
its own copy of an array with the same elements. if you
don't make a deep copy, then %arr2 will point to the same
array as %arr1 and changing $arr2{key3}->[0] will also
change $arr1{key3}->[0]. sometimes this is what you want,
other times it is a disaster.
hth,
--
___cliff [EMAIL PROTECTED]http://www.genwax.com/
baby lakshmi wrote:
> hi
> what abt this??
> %arr1=qw(this 1 is 2 a 3 sample 4 program 5);
> %arr2=%arr1;
> print $arr2{this};
>
>