#!/usr/bin/perl #********************************************************* # Example of a simple module # # by Al Bento # Defines the module Rest with two functions #********************************************************* package Rest; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(convert subsnew $PI $AB); $PI = 3.14159265359; $AB = "Dr. Al Bento"; ########################## SUBS DEFINITION ####################### #sub to convert Fahrenheit into Celsius # call using: &convert($f, $celsius); sub convert { $_[1] = 5/9 * ($_[0]-32); } #sub to eliminate blanks and lowercase and return # call using: &subsnew($toclean); sub subsnew { $_[0] =~ s/\W//g; # remove all blanks (global) $_[0] =~ tr/A-Z/a-z/; # convert to lower case return $_[0] }