Thats what I have so far....#made this events_array up... but the concept remains It will always be in a particular order, least to greatest in this cas +e. @events_aray = ("1","3","3","4","5","5"); my %days; my @appears; my @date_count; my $c = 0; foreach my $v (@events_aray) { #this foreach will split the values of the array I have populated #it will then produce a hash with keys as a date. #another array will be generated containing each dates of the event. + my ($date, $subject, $text) = split(/,/, $events_array); $days{$date} .= "<b>$subject($symbolx)<b><br><br>$text<br><br>"; $date_count[$c] = "$date"; #this stores the date of the event, thi +s will be the array I need to figure out how many times each date app +ears $c++; } #some subroutine to figure out how to retrieve the amount. #The array + that I said I needed to generate will be @appears. #this is where I need a little help on. I will continue #looking thou +gh and if resolved I will post back asap. $c = 0; foreach my $u (keys %days) { print "date appeared $appears[$c] times"; print "<br><br>$days{$u}"; $c++; }
In reply to Re: extract number of times a value appears in an array
by Anonymous Monk
in thread extract number of times a value appears in an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |