in reply to Re^3: to loop through an array
in thread to loop through an array and store each of the subtotals in the elements of another array
my %count; for my $element (@findle) { if (/\Q$element\E/ ) { print "$_\n"; $number++; # push @hit $element; $count{$element}++; #@lines = # print ("there are : " . $number); } } for my $element (@findle) { print "$element\t=>$count{$element}\n"; }
Hashes are probably Perl's greatest strength. A read through of perldata will tell you a bit more about them.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: to loop through an array
by alexlearn (Initiate) on May 13, 2011 at 20:42 UTC | |
by kennethk (Abbot) on May 16, 2011 at 14:11 UTC |