Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello Monks,

I am trying to store a set of arrays into a master array for later processing. In my example below, I have 5 arrays that I want to store in a master array called @rows. But when I try printing the values in @rows, it only displays the first element of each row. Any help would be appreciated.

Ken

my @row1 = qw(71 22 15 10 51); my @row2 = qw(91 82 28 11 91); my @row3 = qw(11 72 37 58 20); my @row4 = qw(21 42 63 24 16); my @row5 = qw(81 32 53 54 42); my @rows = (); @rows[0] = @row1; @rows[1] = @row2; @rows[2] = @row3; @rows[3] = @row4; @rows[4] = @row5; $i = 0; while ($i <= 4) { print "@rows[$i]\n"; $i++; }

In reply to How to store arrays in another array by kwatts59

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-26 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found