in reply to Re^2: Array_ref into Array_ref Help.
in thread Array_ref into Array_ref Help.

What have you tried?

my $ref_a = [ [ qw/a b c/ ], [ qw/d e f/ ], [ qw/g h i/ ], ]; my $ref_b = [ [ qw/j k l/ ], [ qw/m n o/ ], [ qw/p q r/ ], ]; for my $i (0..$#$ref_a) { push @{$ref_a->[$i]}, @{$ref_b->[$i]}; }

Replies are listed 'Best First'.
Re^4: Array_ref into Array_ref Help.
by Anonymous Monk on Apr 22, 2009 at 18:08 UTC
    That would work, one question to you would be:
    my $ref_a = [ [ qw/a b c/ ], [ qw/d e f/ ], [ qw/g h i/ ], [ qw/x y z/ ], [ qw/3 4 5/ ], [ qw/6 7 9/ ], ]; my $ref_b = [ [ qw/j k l/ ], [ qw/m n o/ ], [ qw/p q r/ ], ]; for my $i (0..$#$ref_a) { push @{$ref_a->[$i]}, @{$ref_b->[$i]}; }

    How could I assign maybe a empty value in order not get an error, if the results from one of the array_ref will be like the sample code here.
      I wouldn't be too upset if you tried out this one on your own...
        That's right, but the reason to ask is that what and where would be the more logical place to check for inconsistency, check first if the element is empty or undef and where to assign a empty value so when displaying the report it would show a blank space on the report.