in reply to Selecting particular key-value pairs in hashes

delete @hash{grep !/\d+_\d+/, keys %hash};
Doesn't work in Perl versions before about 5.002, but should work in anything released in the last half dozen years.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^2: Selecting particular key-value pairs in hashes
by gaal (Parson) on Sep 18, 2004 at 07:24 UTC
    And, of course, you can omit the delete if you want the expression to evaluate to the desired hash without modifying the original data.
Re^2: Selecting particular key-value pairs in hashes
by kiat (Vicar) on Sep 18, 2004 at 03:07 UTC
    Thanks, merlyn!

    With that, I can now proceed with my coding.

      foreach (keys %hash) { delete($hash{$_}) if ($_ !~ /\d+_\d+/); }
      Going to see if merlyn's example works on my version of Perl... Oh neat, it does. I think his trumps mine by a bit.