Hi, ok. Let me clarify whether if it means what I thought it is for some parts of the code.
sub makeRatio { my( $d_h ) = @_; my $rows = $#$d_h ; ## last index of array my $columns = $#{ $d_h->[0] }; ## last index of first row my @ratio;
$d_h refers to the dataset from column 4 onwards excluding the first three columns. my $columns : storing the last index of $_[0]
for my $six ( 0 .. $columns ){ for my $tre ( 0 .. $rows ){ for my $tri ( 0 .. $rows ){ ## for visual matching printf 'my $ratio%d_%d_%d = $$d_h[%d][%d] / $$d_h[%d] +[%d];'."\n",
I am looping through 6 columns ($six), and in each column, I will do ratio against two values ($tre and $tri).

$ratio%d_%d_%d refers to the ratio between two values in decimal. (But why three %d?)

1+$six, 1+$tri, 1+$tre, $tri, $six, $tre, $six, ;;; $ratio[ $six ][ $tri ][ $tre ] = $$d_h[ $tri ][ $six ] + / $$d_h[ $tre ][ $six ] ; } } } return \@ratio ; }

1+$six, 1+$tri, 1+$tre, refer to looping next loop?

what does this addition of code do?
$tri, $six, $tre, $six,

Pardon my limited knowledge but it is the first time I see the statement ended with "," instead of ";" , instead the ";" is added below the functions. So may I know if there is any article that explain that or..?

And is
$ratio[ $six ][ $tri ][ $tre ] = $$d_h[ $tri ][ $six ] / $$d_h[ $tre ] +[ $six ] ;
the same as
$ratio = $$d_h[ $tri ][ $six ] / $$d_h[ $tre ][ $six ] ;
Thanks for your patience in coaching me so far..I really really appreciate it.

In reply to Re^16: How to store the output from foreach loop into variable/array without printing? by hellohello1
in thread How to store the output from foreach loop into variable/array without printing? by hellohello1

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.