in reply to Re: Re: Matching values in array
in thread Matching values in array

What's wrong with grep?
print "XXXXXX has appeared ", scalar grep(m/XXXXXX/, @PatternArray), " times.\n"; ... my $count = scalar grep m/XXXXXX/, @PatternArray;

Replies are listed 'Best First'.
Re: Re: Re: Re: Matching values in array
by Anonymous Monk on Mar 02, 2004 at 06:40 UTC
    It does not work with grep, why?.. who knows. The matching is working now, I use your
    chomp(my @PatternArray = map { /^\s*$/ ? () : $_ } <DATA>);
    to read my passwd from the text to the array and I using the following to match
    my %PassValues; @PassValues{@PasswordsArray}=(); if (exists $PassValues{$passwordKey}){ my $count = $passwordKey; $frequency{$count}++; }