in reply to Selecting particular key-value pairs in hashes
Simply test the keys against your pattern:
foreach my $key ( keys %hash ) { if( $key =~ m/\d+_\d+/ ) { print "key = $key, value = $hash{$key}\n"; } }
Or am I missing something?
HTH
Update: I forgot about the "modify hash" requirement - sorry. merlyn came up with a great one-liner, of course!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Selecting particular key-value pairs in hashes
by kiat (Vicar) on Sep 18, 2004 at 03:02 UTC | |
|
Re^2: Selecting particular key-value pairs in hashes
by Aristotle (Chancellor) on Sep 18, 2004 at 22:00 UTC |