This is not homework lol.

I wish it was though, wouldn't be as stressful.

My coding

#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++; }
Thats what I have so far....

thanks, John

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.