Hello, I am not a novice, but I am having a hard time coding my thought out solutions. I was seeking advanced wisdom on a tricky subject of arrays and hashing.

I have to perform statistics on how many unique MAC addresses ($usrMac), per Access Point ($apMac) per hour. I have all the foundational regexes to parse the data, I'm just stuck on coding a solution, to my thought process.

Unknowns: number of access points, number of user devices, and number of hours in a day (-: joking :-)
use strict; use warnings; use diagnostics; use Data::Dumper qw(Dumper); our (@uniqueMac); while (<>) { my ($dateHour,$usrMac,$apMac) = (/regex/); push (@usrMac, $usrMac); @uniqueMac = map {$_ = 1} @usrMac; push (@array, $dateHour{$apMac} = scalar(@uniqueMac); } print @array;
Output: should look like
Date , Hour: AP# : Unique Devices per AP per Hour $dateHour : $apMac : scalar(@uniqueMac) 2014-04-07, Hour 01: AP1 : 301 2014-04-07, Hour 01: AP2 : 313 2014-04-07, Hour 01: AP3 : 132 . . . every hour per day . . . 2014-04-07, Hour 21: AP1 : 130 2014-04-07, Hour 21: AP2 : 310 2014-04-07, Hour 21: AP3 : 13 . . . for every day . . . 2014-04-08, Hour 01: AP1 : 302 2014-04-08, Hour 01: AP2 : 321 2014-04-08, Hour 01: AP3 : 131 . . . every hour per day . . . 2014-04-08, Hour 22: AP1 : 122 2014-04-08, Hour 22: AP2 : 234 2014-04-08, Hour 22: AP3 : 311
Thanks, jcrush

In reply to Array of Hashes of Arrays with Counts of Unique Elements by jcrush

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.