# math.pm - a perl package. NOTE there is no line invoking perl package math; # this is VERY important use strict; # find the area of a circle. The parameters is the radius sub area_of_circle { my $radius=shift @_; 3.14159*$radius*$radius; } #find the volume of a cube. Three parameters: length, width and depth sub volume_of_cube { my $length=shift @_; my $width=shift @_; my $depth=shift @_; $length*$width*$depth; } #find the minimum value sub find_min { my $least=shift @_; my $a; for($a=0;$a<=$#_;$a++) { if($_[$a]<$least) { $least=$_[$a]; } } $least; } 1 # older versions of perl require a 1 on the last line