in reply to Re: How to make this code more flexible
in thread How to make this code more flexible

why print out the first row third column?? (i had an error in that line) and will this work if you dont specify the dimensions to be 5 by 7? cuz thats wat im going for,

  • Comment on Re^2: How to make this code more flexible

Replies are listed 'Best First'.
Re^3: How to make this code more flexible
by Sandy (Curate) on Jul 21, 2011 at 22:11 UTC
    Why'd I print the first row, third column? I was just demonstrating. It worked for me when I tested it, so I don't know why it does not work for you. Note that I changed the return from a hash to an array.

    The whole idea is that you specify the matrix size in the call to the sub.

    So, you are just learning? Play with the code a bit to see what happens. That's one of the best ways to learn.

      okay, and the data dumper shows nothing but "undefined"
        My code gives exactly the following.
        perl tst.pl $VAR1 = [ [ '11', '12', '13', '14', '15', '16', '17' ], [ '21', '22', '23', '24', '25', '26', '27' ], [ '31', '32', '33', '34', '35', '36', '37' ], [ '41', '42', '43', '44', '45', '46', '47' ], [ '51', '52', '53', '54', '55', '56', '57' ] ]; 1st row, 3rd column: 13
        You need to compare carefully the differences between what I wrote, and what you wrote.

        Are you calling the function with three parameters?