my @days = qw( Monday Tuesday Wednesday Thursday Friday Saturday Sunday ); my @hours = (7..21); # use the start hour for the value; my $out = qq( Day); for my $hour (@hours) { $out .= "$hour - " . $hour + 1 . ""; for my $day (@days) { $out .= qq( $day); for my $hour (@hours) { $out .= qq(); } $out .= qq(); } # so now you've printed out the form; # now to get the data out of it: use CGI; my $q = CGI->new; for my $day (@days) { @hours = $q->param($day); # the hours for the day are now in the array. $Hours->{$day} = \@hours; }