Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: How to make this code more flexible

by Sandy (Curate)
on Jul 21, 2011 at 22:11 UTC ( [id://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

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-25 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found