$d_h refers to the dataset from column 4 onwards excluding the first three columns. my $columns : storing the last index of $_[0]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;
I am looping through 6 columns ($six), and in each column, I will do ratio against two values ($tre and $tri).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",
$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 isthe same as$ratio[ $six ][ $tri ][ $tre ] = $$d_h[ $tri ][ $six ] / $$d_h[ $tre ] +[ $six ] ;
Thanks for your patience in coaching me so far..I really really appreciate it.$ratio = $$d_h[ $tri ][ $six ] / $$d_h[ $tre ][ $six ] ;
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |