my $stmt = 'SELECT projects FROM time_sheet WHERE subscriber_id = ?';
my $proj = $dbh->selectall_arrayref($stmt, {Slice => {}}, $subscriber_id);
$stmt = 'SELECT users FROM time_sheet project_id = ?';
for my $i ( 0 .. $#$proj ) {
my $time = $dbh->selectall_arrayref($stmt, {Slice => {}}, $project_id);
for my $j ( 0 .. $#$time ) {
push @users, $time->[$j];
}
$proj->[$i]{'users'} = \@users;
undef @users;
}
####
print Dumper($proj);
$VAR1 = [
{
'number' => 'CGL00507',
'project_title' => 'Website',
'subtotal' => 2,
'users' => $VAR1->[0]{'users'},
'project_id' => '7599'
}
];
####
my $AoH_class = [
{
'class' => 'Algebra',
'room' => '204',
},
{
'class' => 'Science',
'room' => '413',
}
];
my @AoH_algebra = (
{
'name' => 'Fred',
'level' => 'junior',
},
{
'name' => 'Barney',
'level' => 'senior',
}
);
$AoH_class->[1]{'students'} = \@AoH_algebra;
print Dumper($AoH_class);
####
$VAR1 = [
{
'class' => 'Algebra',
'room' => '204'
},
{
'students' => [
{
'level' => 'junior',
'name' => 'Fred'
},
{
'level' => 'senior',
'name' => 'Barney'
}
],
'class' => 'Science',
'room' => '413'
}
];