From this, Data::Dumper gives me:%datastructure=( 'foo' => [ [ 'foo01', 'foo02' ], [ 'foo11', 'foo12' ] ], 'bar' => [ [ 'bar01', 'bar02' ], [ 'bar11', 'bar12' ] ] );
So far, so good. Now, what I want to do is shift out the first list from the 'foo' record, (i.e. return me the list ('foo01', 'foo02'), and remove that entry from the datastructure). The code I'm using for this is as follows:$VAR1 = 'foo'; $VAR2 = [ [ 'foo01', 'foo02' ], [ 'foo11', 'foo12' ] ]; $VAR3 = 'bar'; $VAR4 = [ [ 'bar01', 'bar02' ], [ 'bar11', 'bar12' ] ];
Now, this appears to work in that it removes the correct information from the data structure; however, rather than return it as a simple list, it returns it as a list which contains one element which is the list that I want (i.e. a LoL). This is confirmed by Data::Dumper - @entry is printed as:my @entry = shift(@{@datastructure{'foo'}});
Whereas creating a list manually:$VAR1 = [ 'foo01', 'foo02' ];
gives:@my_list = ('foo01', 'foo02');
So, how do I get my LoL into just a simple list?$VAR1 = 'foo01'; $VAR2 = 'foo02';
gives:Dumper(@entry);
whilst$VAR1 = [ 'foo01', 'foo02' ];
also gives:Dumper(@entry->[0]);
but$VAR1 = [ 'foo01', 'foo02' ];
gives:Dumper(@entry->[0]->[0]);
i.e. I can get either a LoL or a single element, but nothing inbetween. I'm confused!$VAR1 = 'foo01';
In reply to Data structures problem by MrFlibble
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |