Amblikai has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks, i'm trying to get my head around some more complicated data structures and i'm wondering how best to represent my data.
I hope i explain this ok but basically i have the following:
my @user_file_part1=(); my @user_file_part2=(); my @user_file_part3=(); my @test_file_part1=(); my @test_file_part2=(); my @test_file_part3=(); my @trim_file_part1=(); my @trim_file_part2=(); my @trim_file_part3=(); my @user_file=(\@user_file_part1, \@user_file_part2, \@user_file_part3); my @test_file=(\@test_file_part1, \@test_file_part2, \@test_file_part3); my @trim_file=(\@trim_file_part1, \@trim_file_part2, \@trim_file_part3); my %main_file=( USER <= \@user_file, TEST <= \@test_file, TRIM <= \@trim_file, );
So i have a hash of arrays of arrays if that makes sense (my brain is mush now!)
So my question after all that is, how can i better represent the above code? Do i have to make the array declarations before i take their reference or can i do that at the same time?
Also, if i wanted to push a value onto one of the end arrays, i.e. @user_file_part1, how would i reference it?
Like this?
push(@{$main_file{"USER"}[0]}, $string);
Thanks in advance!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to better represent a complex data structure.
by BrowserUk (Patriarch) on Jan 08, 2013 at 16:19 UTC | |
by Amblikai (Scribe) on Jan 08, 2013 at 17:15 UTC | |
Re: How to better represent a complex data structure.
by choroba (Cardinal) on Jan 08, 2013 at 16:10 UTC | |
by Amblikai (Scribe) on Jan 08, 2013 at 17:13 UTC | |
Re: How to better represent a complex data structure.
by muba (Priest) on Jan 08, 2013 at 16:26 UTC | |
by Amblikai (Scribe) on Jan 08, 2013 at 17:17 UTC | |
Re: How to better represent a complex data structure.
by sundialsvc4 (Abbot) on Jan 08, 2013 at 20:02 UTC | |
by eyepopslikeamosquito (Archbishop) on Jan 09, 2013 at 10:11 UTC | |
by Amblikai (Scribe) on Jan 08, 2013 at 20:18 UTC |
Back to
Seekers of Perl Wisdom