Hello all, I am a bit confused with the approach to nesting arrays. What my program does: randomly select a string with four elements from a data frame with 1553 strings, 1553 times and store the new order of these strings within an array or data frame. Then I would like to repeat this 1,000 times.

I have written this to output each rearranged assembly of 1553 strings into a separate output file because I do not understand how to store a matrix within a matrix. Could someone help explain the concept behind this idea?

# Inputs my $runs = 100000; # 1e5 - the num of times we repeat the exper +iment # Program vars my $i; # a looping variable my $j; # another looping var my $range = 1553; # the number of total window +s with data my $count = 0; # variable tracking pseudo X output + files # Outer loop: Repeat "$runs" times for ($j = 0; $j < $runs; $j++) { for ($i = 0; $i < $range + 1 ; $i++) { # choose a randomly selected string chomp @X_info; my @get_X = split('\s+', $X_info[int(rand($range))]); my $output_file = "/Users/statistical_analysis/pseudo_X/pseuo_ +X_"."$count".".txt"; open (OUT, ">$output_file") or die "can't open output file"; print OUT "@get_X\n"; } } $count++;

In reply to A Question with Nesting Arrays by ccelt09

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.