# your initial definitions here # maybe a loop starts here my $student; # single student my @students; # all students in 1 class $student = { studentName => 'John', studentSurname=>'Something', studentID=>'9534', age=>'12' }; push @students, $student; # Eliminate loading next student below explicitly # by using a loop to read from source file, DB, etc. $student = { studentName => 'Mary', studentSurname=>'Something2', studentID=>'5489', age=>'13' }; push @students, $student; %classroom = ( classroomID => 10, classroomName => 'classroom1', students => \@students ); # Rinse, repeat