perl makeRatioDebVisMat.pl >n-out-deb.txt perl makeRatioTriAgain.pl >n-out-tri.txt perl makeRatioTriAliasAgain.pl >n-out-ali.txt perl makeRatioTreAgain.pl >n-out-tre.txt $ md5sum n-out*txt 40b87695df5c3f839717dfb3538c029b *n-out-ali.txt 40b87695df5c3f839717dfb3538c029b *n-out-deb.txt 40b87695df5c3f839717dfb3538c029b *n-out-tre.txt 40b87695df5c3f839717dfb3538c029b *n-out-tri.txt #### #!/usr/bin/perl -- ## by us ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd /; Main( @ARGV ); exit( 0 ); sub Main { UsedToBeJustDoWork(); } sub UsedToBeJustDoWork { my $d_h = [ [ 287.41, 217.76, 231.21, 746.84, 661.86, 812.52 ], [ 503.91, 579.54, 418.29, 1613.59, 1689.682, 1542.565 ], [ 288.69, 358.43, 231.10, 817.81, 996.18, 763.18 ], ]; my $ratio_ref = makeRatioTreAgain( $d_h ); dd( $ratio_ref ); } sub makeRatioTreAgain { my( $d_h ) = @_; my $rows = $#$d_h; ## last index of array my $columns = $#{ $d_h->[0] }; ## last index of first row my @ratio; for my $six ( 0 .. $columns ) { TreAgain( $six, $rows, \@ratio, $d_h ); print "\n"; } return \@ratio; } ## end sub makeRatioTreAgain sub TreAgain { my( $six, $rows, $ratio_ref, $d_h ) = @_; for my $tre ( 0 .. $rows ) { ddebuggering( $ratio_ref ); TriAgain( $six, $tre, $rows, $ratio_ref, $d_h ); } } sub TriAgain { my( $six, $tre, $rows, $ratio, $d_h ) = @_; for my $tri ( 0 .. $rows ) { DebugVisualMatching( $six, $tri, $tre ); ## used to be #~ $ratio[ $six ][ $tri ][ $tre ] = $$d_h[ $tri ][ $six ] / $$d_h[ $tre ][ $six ] ; ## can be written as #~ $ratio->[ $six ][ $tri ][ $tre ] = $$d_h[ $tri ][ $six ] / $$d_h[ $tre ][ $six ] ; ## or as $$ratio[$six][$tri][$tre] = $$d_h[$tri][$six] / $$d_h[$tre][$six]; } } ## end sub TriAgain sub DebugVisualMatching { my( $six, $tri, $tre ) = @_; ## for visual matching printf 'my $ratio%d_%d_%d = $$d_h[%d][%d] / $$d_h[%d][%d];' . "\n", 1 + $six, 1 + $tri, 1 + $tre, $tri, $six, $tre, $six, ; } sub ddebuggering { warn Data::Dump::pp( @_ ), "\n"; }