in reply to Perl reference array
$arr= [ [1,2,3,4,5,6,7,8,9 ], #works as expected [1,2,3,'',5,6,7,'',9 ], #works as expected [1,2,3, ,5,6,7, ,9 ], #does not work as expected "empty fields " + are ignored ]; my $dd=Data::Dumper->new([$arr],[ qw(arr) ] )->Indent(1)->Quotekeys(0) +->Dump; print $dd; $arr = [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ], [ 1, 2, 3, '', 5, 6, 7, '', 9 ], [ 1, 2, 3, 5, 6, 7, 9 ] ];
as you can see from the dump in the last record there are less fields then I mentioned in the definition of $arr. When I quote the "emty fields" everything is OK. however when I just use a sequence of , , or ,, the index of the array is not updated. Hence the less fields in the last record. Should expect that all records have the same number of indexes, which is not the case.
Is there a way that the "empty fields" , as i call them can be initialized to undef. In my opinion this should be the case.
Thanks in advance Greeting ,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl reference array
by LanX (Saint) on Mar 28, 2015 at 21:38 UTC | |
by teun-arno (Acolyte) on Mar 28, 2015 at 21:46 UTC | |
by LanX (Saint) on Mar 28, 2015 at 21:59 UTC |