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

Thanks for answering,but my problem is that I will count the occurance ONLY If the referred passwordKey match the passwd in DATA... maybe I was not too clear in my message sorry

Replies are listed 'Best First'.
Re: Re: Re: Matching values in array
by Roger (Parson) on Mar 02, 2004 at 06:21 UTC
    What's wrong with grep?
    print "XXXXXX has appeared ", scalar grep(m/XXXXXX/, @PatternArray), " times.\n"; ... my $count = scalar grep m/XXXXXX/, @PatternArray;

      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}++; }