The mainOne (thanks davido ;-) problem is, that sub printname lives in the package printname::.
Your main program lives in the package main::.
To access sub printname() from your main program, you either need to access it like so printname::printname("John") or by exporting sub printname() from package printname::
into package main::. The latter allows it to work as you expected in your example.
The module Exporter helps you to import the prinname::printname() to main::printname(). BTW, lowercase package names are reseved for pragmas.
An introduction to writing modules can be found in perlmod, etc.
In reply to Re: Custom Module question
by Perlbotics
in thread Custom Module question
by imfaus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |