in reply to Re^2: Passing Along Arrays
in thread Passing Along Arrays
Is this an accurate depiction of what you are attempting?
perl -E ' use strict; use warnings; my @projects; push @projects, [ [ "the", "data" ], "key"]; push @projects, [ [ "more", "data" ], "another key"]; for (@projects) { my @data = @{ $_->[0] }; my $key = $_->[1]; say "DATA: @data"; say "KEY: $key"; } '
OUTPUT:
DATA: the data KEY: key DATA: more data KEY: another key
I suggest you print (or use Data::Dumper/Data::Printer on @contents before it is returned and on $_ in the for loop to see what all is going on.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Passing Along Arrays
by Perl_Ally (Novice) on Aug 26, 2014 at 21:14 UTC | |
Re^4: Passing Along Arrays
by Perl_Ally (Novice) on Aug 26, 2014 at 21:36 UTC | |
by frozenwithjoy (Priest) on Aug 26, 2014 at 22:13 UTC | |
by 2teez (Vicar) on Aug 26, 2014 at 21:52 UTC | |
by Perl_Ally (Novice) on Aug 27, 2014 at 13:27 UTC | |
by Perl_Ally (Novice) on Aug 27, 2014 at 13:40 UTC |
In Section
Seekers of Perl Wisdom