http://qs1969.pair.com?node_id=916008


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

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.

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

Replies are listed 'Best First'.
Re^4: How to make this code more flexible
by DanielM0412 (Acolyte) on Jul 25, 2011 at 14:07 UTC
    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?

        what does variable i and j represent?? is it the dimensions of the array? (sorry for asking the obvious, im not sure) and i will look closer, thanks