Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: How to make this code more flexible

by Sandy (Curate)
on Jul 21, 2011 at 22:11 UTC ( #916008=note: print w/ replies, xml ) Need Help??


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
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://916008]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-10-25 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (141 votes), past polls