# -- connect to Voyager db my $dbh = DBI->connect( $voy_dsn,$voy_dbun,$voy_dbpass, { AutoCommit => 0, RaiseError => 0, PrintError => 1 } ) || die $DBI::errstr; # -- get normal hours of operations # -- yes, believe it or not there is only one row (there must be a reason for this setup but I can't think of one) my $sql = qq(SELECT sunday_open,sunday_openhour,sunday_closehour, monday_open,monday_openhour,monday_closehour, tuesday_open,tuesday_openhour,tuesday_closehour, wednesday_open,wednesday_openhour,wednesday_closehour, thursday_open,thursday_openhour,thursday_closehour, friday_open,friday_openhour,friday_closehour, saturday_open,saturday_openhour,saturday_closehour FROM calendar WHERE calendar_desc = '$voy_cal2use'); my $sth = $dbh->prepare( $sql ); $sth->execute; my @row = $sth->fetchrow->array; my $today = today; my @day = map $today + $_, 0 .. 6; my @data; for my $i (0 .. 6) { push @data, {dow => $day[$i]->day_of_week, name => $day[$i]->strftime("%A")}; } my $date = shift @data; # you have $date->{name} here too my $i = 3 * $date->{dow}; my @today_info = @row[$i .. $i+2]; # write today's info to html # drop down list for my $date (@data) { # You have access here to $date->{dow} and $date->{name} my $i = 3 * $date->{dow}; my @info = @row[$i .. $i+2]; # write this day's info to drop down list }