stu96art has asked for the wisdom of the Perl Monks concerning the following question:
Any help would be greatly appreciated, even a small subroutine, where I have to give it global variables, it uses them by naming them different local variables and does calculations, then gives return variables. Thanks{ $xachange = ($blocks[$blockcount][$icount][1] - $datapoint[($blocks[$b +lockcount][$icount][5])][1]); $xbchange = (($datapoint[($blocks[$blockcount][$icount][5] +)][1]) - ($blocks[$blockcount][($icount + 1)][1])); $yachange = ($blocks[$blockcount][$icount][2] - $datapoint +[($blocks[$blockcount][$icount][5])][2]); $ybchange = (($datapoint[($blocks[$blockcount][$icount][5] +)][2]) - ($blocks[$blockcount][($icount + 1)][2])); $da = sqrt(($xachange*$xachange) + ($yachange*$yachange)); $db = sqrt(($xbchange*$xbchange) + ($ybchange*$ybchange)); $nxa = (($blocks[$blockcount][$icount][1] + ($xachange/$da +)*$radius)); $nya = (($blocks[$blockcount][$icount][2] + ($yachange/$da +)*$radius)); $nxb = (($blocks[$blockcount][$icount][1] + ($xbchange/$db +)*$radius)); $nyb = (($blocks[$blockcount][$icount][2] + ($ybchange/$db +)*$radius)); $gxa1 = $nxa / 25.4; $gya1 = $nya / 25.4; $gxb1 = $nxb / 25.4; $gyb1 = $nyb / 25.4; $gpx = $datapoint[($blocks[$blockcount][$icount][5])][1] / + 25.4; $gpy = $datapoint[($blocks[$blockcount][$icount][5])][2] / + 25.4; select JOB; printf "G01X%.3fY%.3f\n", $gxa1, $gya1; printf "G03X%.3fY%.3fI%.3fJ%.3f\n", $gxb1, $gyb1, $gpx, $g +py; select STDOUT; print " 1 [4] G033333333333333333 $blockcount, $icount, 1 +\n"; $blocks[$blockcount][$icount][3] = 1; $icount = $icount + 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: subroutine help
by dragonchild (Archbishop) on Feb 12, 2003 at 21:33 UTC | |
|
Re: subroutine help
by tall_man (Parson) on Feb 13, 2003 at 01:49 UTC |