I've answered my own question:
my $ID = "020";
my $rh1 = {id => 1, value => "020", name => "one"};
my $rh2 = {id => 2, value => "040", name => "two"};
my $rh3 = {id => 3, value => "034", name => "three"};
my $rh4 = {id => 4, value => "056", name => "four"};
my $rh5 = {id => 5, value => "030", name => "five"};
my @HOLDER = ($rh1, $rh2, $rh3, $rh4, $rh5);
my @tester = grep($_->{value} eq $ID, @HOLDER);
Dump(\@tester, "tester", 0);
sub Dump($$$)
{
my($thing, $name, $lLevel) = @_;
my $sTab = "\t" x $lLevel;
$lLevel++;
print "$sTab"."dumping $name\n";
if(ref($thing) eq "ARRAY")
{
print "$sTab"."found array:\n";
my $lCount = 0;
foreach my $item (@{ $thing })
{
Dump($item, "element $lCount", $lLevel);
$lCount++;
}
}
elsif(ref($thing) eq "HASH")
{
print "$sTab"."found hash:\n";
foreach my $key (sort(keys %{ $thing }))
{
Dump($thing->{$key}, $key, $lLevel);
}
}
else
{
print "$sTab$thing\n";
}
}
At 09:50 18.05.2001 +0200, you wrote:
>I haven't really played with grep at all, except for doing the standard
>stuff on dirs.
>
>Your example is wonderfully concise -- is there any way that you can
>expand on this to get more information out of the test, ie which member of
>the array matches, or returning the member if this were in a function?
>
>At 13:16 17.05.2001 -0700, you wrote:
>> $TEST1 = "030";
>> @HOLDER = ("020", "040", "034", "056", "030");
>>
>> > I need to find out if "030" is present in the array HOLDER
>>
>> print "gotit\n" if grep /^$TEST1$/, @HOLDER;
>
>Aaron Craig
>Programming
>iSoftitler.com
>
Aaron Craig
Programming
iSoftitler.com