.....
One can have great fun with AUTOLOAD routines that serve as wrappers to other interfaces. For example, let's pretend that any function that isn't defined should just call system with its arguments. All you'd do is this:
sub AUTOLOAD {
my $program = our $AUTOLOAD;
$program =~ s/.*:://; # trim package name
system($program, @_);
}
(Congratulations, you've now implemented a rudimentary form of the Shell module that comes standard with Perl.) You can call your autoloader (on Unix) like this:
date();
who('am', 'i');
ls('-l');
echo("Abadugabudabuda...");
In fact, if you predeclare the functions you want to call that way, you can pretend they're built-ins and omit the parentheses on the call:
sub date (;$$); # Allow zero to two arguments.
sub who (;$$$$); # Allow zero to four args.
sub ls; # Allow any number of args.
sub echo ($@); # Allow at least one arg.
date;
who "am", "i";
ls "-l";
echo "That's all, folks!";
....
From Programming Perl 3rd