The following illustrates this
#! /usr/bin/perl use strict; use warnings; my @array = qw (one two three four five); my %hash = (one => 'Extra information for one', two => 'Extra information for two'); foreach my $id (@array) { if (exists $hash{$id}) { print "ID: $id has extra info: $hash{$id}\n"; } else { print "ID: $id has no extra info\n"; } }
In reply to Re: searching for values in hashes
by inman
in thread searching for values in hashes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |