My goal is to correlate the data in 2 arrays into a
HoH or a HoA so that when I print this data in an HTML
table so it comes out correctly.
 

snippet...

my (@weeks, @weeks1, @weeks_AoA,) = ((),(),());

## Set up array with dates minus 15 days and plus 15
days from current date ##

foreach $day ('-15' .. '15') {
 run_statement( "select date_format(date_add(curdate 
    (), interval '$day' day), '%b %e, %Y');" );
    push (@weeks, $sth->fetchrow);
} 

## Match up dates with dayofweek numbers with above
array ##

foreach $day1 ('-15' .. '15') {
 run_statement( "select dayofweek(date_add(curdate(), 

    interval '$day1' day));" );
    push (@weeks1, $sth->fetchrow);
}

I then setup this hash:

my %WeekDays = (
    1 => Sunday, 
    2 => Monday,
    3 => Tuesday, 
    4 => Wednesday,
    5 => Thursday, 
    6 => Friday,
    7 => Saturday
);

But my problem is figuring out which data structure to
use considering the following: correlate/match-up the
two array's data elements. For example, in @week an
element is 'Mar 9 2007' and its correlated element in
@weeks1 is '6' and 6 in %WeekDays is 'Friday.'
I see a HoH or a HoHoH ?

## To build:
my %HoH = ();
foreach my $dates (@weeks) {
    foreach my $daynums (@weeks1) {    
        $HoH{$dates} = {
           daynums   => $daynums
       };
    }
}

## To print:
for my $a ( keys %HoH ) {
    for my $e ( keys %{ $HoH{ $a } } ) {
        print $HoH{ $a }{ $e };
    }
}

but its printing all 7's and 7 = Saturday in ODBC
standards.

Any advise?

thank you




 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to