Actually, better not to export at all:
in MyModule.pm:
package MyModule;
sub new { bless {}, shift }
sub foo { "do some foo stuff" }
1;
and in the calling code:
use MyModule;
my $o = new MyModule;
$o->foo();
$o is an object. It can have data, but in this case, it is just a way to tell perl where to find the subroutine foo(). This means you could have several different modules, each with a routine named 'foo;, and by using the object each module returns (customarily) from the call to new(), you can tell them apart. Whereas if you have the misfortune to use 2 modules that both export foo into your namespace, who knows what happens?
--Bob Niederman, http://bob-n.com
All code given here is UNTESTED unless otherwise stated.