Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to count how many times specific passwordKey ocurrs, only if it match passwords from previous array , the following is what I have been trying..open(PFILE, "Activatepasswords.txt")|| die "Cannot open patterns1.txt +file"; my @PatternArray=<PFILE>; close(PFILE); pop @PatternArray if $PatternArray[-1] eq "\n"; @PatternArray = grep /\s/, @PatternArray;
ormy $passwordKey = $pass1; if (grep($_ eq $passwordKey, @PasswordsArray)){ print "ok\n"; my $count = $passwordKey; $frequency{$count}++; }
After this I print the hash with freq, but I am not able to get any result or match.my %PassValues; @PassValues{@PasswordsArray}=(); if (exists $PassValues{$passwordKey}){ print "count\n"; my $count = $passwordKey; $frequency{$count}++; } else { print "Not count\n";; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching values in array
by kvale (Monsignor) on Mar 02, 2004 at 05:28 UTC | |
by Anonymous Monk on Mar 02, 2004 at 05:47 UTC | |
|
Re: Matching values in array
by QM (Parson) on Mar 02, 2004 at 05:10 UTC | |
by Anonymous Monk on Mar 02, 2004 at 05:37 UTC | |
|
Re: Matching values in array
by Roger (Parson) on Mar 02, 2004 at 05:51 UTC | |
by Anonymous Monk on Mar 02, 2004 at 06:13 UTC | |
by Roger (Parson) on Mar 02, 2004 at 06:21 UTC | |
by Anonymous Monk on Mar 02, 2004 at 06:40 UTC | |
|
Re: Matching values in array
by Anonymous Monk on Mar 02, 2004 at 05:04 UTC | |
|
Re: Matching values in array
by TomDLux (Vicar) on Mar 02, 2004 at 17:42 UTC |