Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: 2d array

by BillKSmith (Priest)
on Jan 04, 2013 at 04:34 UTC ( #1011550=note: print w/replies, xml ) Need Help??

in reply to 2d array

"Dynamic" is not a perl data type. I think that you mean that you want changes in the row arrays to appear in the matrix and changes made in the matrix to appear in corresponding row array. The code you posted does do this. If you wanted to initalize the matrix with the current value of the rows, but allow them to modified independently, you would use the [] operator rather than the \ operator.

my @array_2d = ([@row1], [@row2], [@row3], [@row4], [@row5]);

Replies are listed 'Best First'.
Re^2: 2d array
by jnarayan81 (Initiate) on Jan 04, 2013 at 12:18 UTC

    Hi Bill, Thanks for the reply. I updated the question with some portion of my script. Can you please suggest me how to get rid of manual modification in script. Thanks Jit

      I do not understand your application well enough to offer a solution, but I do have several comments.

      Awkward perl code is usually a symptom of a poor choice of data structures. Your code makes extensive use of "symbolic reference." Most text books consider this very poor practice. (It is not even allowed under "use strict".) My first guess would be to change your matrix to hash-of-hashes.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011550]
[GotToBTru]: a ref too far ;)
[thepkd]: Yes this is my first time in cb. Trying to work my way around.
[JohnCub]: "A ref too far" would make a good title for anyone's perl memoirs
[thepkd]: Anyways it works with $aohoaoh[0]->{'foo '}[0]->{'bar'}
[GotToBTru]: "I did it my $way"
[JohnCub]: I hope $way isn't a hashref. ;)
[GotToBTru]: many times i've been told I made a real hash of thiings
[GotToBTru]: so .. perhaps it should b e

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2016-12-06 13:47 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (105 votes). Check out past polls.