develooper Front page | perl.beginners | Postings from March 2002

Forgive my n00biness

From:
Aaron Shurts
Date:
March 1, 2002 16:01
Subject:
Forgive my n00biness
Message ID:
1047D74709F06345A829829080D6AE400101C464@COURIER1.corp.bluelight.com
I have a hash tables that looks like this:

my(%data) = ();
    my($csid) = '';
    $data{$csid} = {};
    $data{$csid}{duration_on} += 0;
    $data{$csid}{duration_off} += 0;
    $data{$csid}{under_peak} += 0;
    $data{$csid}{over_peak} += 0;
    $data{$csid}{under_off} += 0;
    $data{$csid}{over_off} += 0;

I am selecting data out of a mysql db to populate this table.  I am
selecting out $csid, $duration, and $ts.  $csid is a value to store
station ids.  $duration is a the time those station ids have been online
in seconds.  $ts is the timestamp that the ids have gone online.

I want to insert data into the hash from my select using fetchrow_array.
On and off in my hash table refers to an on-peak and an off-peak time
period.  My on peak is 10:00am to 6:00pm and off peak is 12:00am to
9:59am and 6:01pm to 11:59pm.  I am using one select statement to pull
all the days data out, for instance 'WHERE ts BETWEEN 20020228000000 and
20020228235959;'  I need some help populating the hash table.  I am sure
about how to do this.  If someone could offer some advice, I would
appreciate it.  If I am confusing ('cuz I know I just confused myself
:-) ) as hell right, e-mail me and I will try to go into more detail.
Thanks!
Aaron Shurts 





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About