Thank for your help !

i have resolve this promble .

my method is not very good ,but can copy a hash from $h to $h1.


sub copy_hash{
    my ($b) = @_;
    my $cp_hash;
    my($key, $secondkey, $thirdkey);
    my $hash;
    foreach $key ( keys %{$b}) {
     my  $hash=$b->{$key};
     if(ref($hash)){
         foreach $secondkey (keys %$hash){
          my $second_hash = $hash->{$secondkey};
          if(ref($second_hash)){
              foreach $thirdkey( keys  %$second_hash) {
               $cp_hash->{$key}{$secondkey}{$thirdkey} = $second_hash->
{$thirdkey};
              }

          }else {
              $cp_hash->{$key}{$secondkey} = $second_hash;
          }
         }
     }else{
         $cp_hash->{$key} = $hash;
     }
    }
    return $cp_hash;
}


now, you can use
$h1=copy_hash($h);
copy $h to $h1.
but this subroutine method can only use to copy hash of hashes.

somebody has good idea?

welcome to tell me.






********************************
Legend Software Business
Linux   Zhangxinj
Tel£º62986638-6555
E-mail:[EMAIL PROTECTED]
********************************

Reply via email to