Re: [PBML] (unknown)
>>>>> "M" == M Lewis <cajun@...> writes:M> I'd like to get the number of 'wanted' items in an array. For example:
M> my @items = qw'unwanted-1 unwanted-2 item1 item2 item3 unwanted-3 item4
grep in a scalar context counts the winners:
my $count = grep /unwanted/, @items;
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!