Perl: a command-line cube root program

The tutor shows an example program with a few facets to discuss.

So far as I know, to find the cube root in Perl, you need use the principle

The following program calculates the cube root of a number given with the command-line function call:


$input*=-1; #changes value to positive
$input*=-1; #restores original value


sub printout{
print “The cube root of $input is $out\n\n”;

I’ll be explaining some ins and outs of this program next post:)


McGrath, Mike. Perl in easy steps. Southam: Computer Step, 2004.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , , , ,

Leave a Reply