in reply to Array of structures within an array of structures.
Something like this:
UPDATE: In my zest to copy the original code, I made a mistake in my code below. Thanks Laurent_R for pointing it out in the node below. Corrected code follows:
# 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array of structures within an array of structures.
by Laurent_R (Canon) on Sep 20, 2013 at 22:54 UTC | |
|
Re^2: Array of structures within an array of structures.
by VinsWorldcom (Prior) on Sep 20, 2013 at 23:37 UTC |