
IsabelleFr
Novice
May 13, 2013, 10:02 AM
Post #1 of 4
(482 views)
|
Hash to match a for loop!
|
Can't Post
|
|
Hi, boyz! I have a problem and hope that some1 can help me. Well, i'm trying to use a hash (wich i charged previously) to match table items. It's something like this:
open(IN,"<list.txt") or die "Dommage!\n"; while (my $desc = <IN>){ $etat{$desc} =1; } close IN; then i charge a table with some info and read it using a for loop like this:
for (my $i = 0; $i <=$#tab; $i++){ if (defined ($etat{$tab[$i]})){ $abc++; $total_abc++; } I just can't make it match the hash keys with the table items. it's like, if i have in my hash the key "nice" i would like to, when i make the for loop and if it encounters the word "nice", it increments my two variables ($abc and $total_abc). Thanks for helping :)
|