in reply to Selecting a Specific Keys in Relation to a List
Which would output the following. You just replace the print line with whatever operatiosn you need to perform on the "wanted" keys of %hash.my %hash = ( ytd => 1.5, mtd => 2.0, wtd => 2.5, Jumbo_Tron => "United Center", Meat_Pie => "Gross", "Word" => "Association", ); my @do_not_want = qw{ ytd mtd wtd }; foreach my $k (keys %hash) { next if scalar grep { m/$k/ } @do_not_want; print "$k => $hash{$k}\n"; }
Meat_Pie => Gross Jumbo_Tron => United Center Word => Association
---
echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Selecting a Specific Keys in Relation to a List
by TGI (Parson) on Nov 01, 2007 at 19:32 UTC | |
by tuxz0r (Pilgrim) on Nov 02, 2007 at 03:38 UTC | |
by TGI (Parson) on Nov 02, 2007 at 18:33 UTC |