in reply to Re: dynamic 2d array
in thread dynamic 2d array

Sorry, my bad. Been up all night trying to fix this thing and getting a little groggy. The error is this:

Global symbol "@d_array" requires explicit package name at ./subtest.p +l line 10. Execution of ./subtest.pl aborted due to compilation errors.

Replies are listed 'Best First'.
Re^3: dynamic 2d array
by broomduster (Priest) on Aug 14, 2008 at 00:30 UTC
    As you have it, the scope of the my @d_array does not include your sub printRow. Move the sub declaration to the end, or move the my declaration to the top.

    Also, you probably want to be passing array refereces to Dumper (or at least be aware of the different output in the two cases):

    use strict; use warnings; use Data::Dumper; my @ar = qw( a b c ); print Dumper(\@ar); print Dumper(@ar); __END__ $VAR1 = [ 'a', 'b', 'c' ]; $VAR1 = 'a'; $VAR2 = 'b'; $VAR3 = 'c';