in reply to Core Dumping with Arrays
So it works on 5.6. It's funny how the empty elements point to the undef at 0. If you put something there then the empty ones will point to the first empty one, which will be given undef: (What would be the advantage of doing it this way, instead of putting undef on all, as they had on 5.005?)$VAR1 = [ undef, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, 'foo bar' ]; $VAR1 = [ undef, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, ${\$VAR1->[0]}, 'foo bar' ];
#!/usr/bin/perl -w use strict; use Data::Dumper; my @comps; $comps[10] = "foo bar"; $comps[0] = "foo bar"; $comps[4] = "foo bar"; print Dumper \@comps; my $base = "Foo bar"; print Dumper \@comps; outputs: $VAR1 = [ 'foo bar', undef, ${\$VAR1->[1]}, ${\$VAR1->[1]}, 'foo bar', ${\$VAR1->[1]}, ${\$VAR1->[1]}, ${\$VAR1->[1]}, ${\$VAR1->[1]}, ${\$VAR1->[1]}, 'foo bar' ]; $VAR1 = [ 'foo bar', undef, ${\$VAR1->[1]}, ${\$VAR1->[1]}, 'foo bar', ${\$VAR1->[1]}, ${\$VAR1->[1]}, ${\$VAR1->[1]}, ${\$VAR1->[1]}, ${\$VAR1->[1]}, 'foo bar' ];
|
|---|