wstarrs has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to move a key from one hash to antoher if it passes certain criteria based on it's values, what is the correct syntax to move from one hash to another?
  • Comment on How do I move specific values from one hash to another?

Replies are listed 'Best First'.
Re: How do I move specific values from one hash to another?
by I0 (Priest) on May 14, 2001 at 23:17 UTC
    $newhash{$key} = $oldhash{$key}; delete $oldhash{$key};

      I prefer this:

      $newhash{$key}= delete $oldhash{$key}; #or @newhash{@keys}= delete @oldhash{@keys};

              - tye (but my friends call me "Tye")
      or...
      $newhash{$key} = delete $oldhash{$key};
      for a one line approach

      Update ack! Tye beat me to it... :)
                      - Ant