in reply to calling perl subroutine from shell

Just two details:
1. You can use
#!/usr/bin/perl
as the first line in yourscript.pl, which becomes "executable" - it means that you can run it from command line in the same manner as shell script (don't forget chmod 755, for instance).

2. Don't use names of your modules starting with lowercase. It can cause collision with perl internals and unexpected behavior as the effect.