I am working with different subroutines of a Perl script. It is possible to call a single subroutine from the Perl script via the Unix shell like:
simplified examples:
perl automated_mailing.pl inf
then the function inform_user from automated_mailing.pl gets called.
This is realized through a dispatch table:
my %functions = (
inf=> \&inform_user,
);
inform_user looks like
sub inform_user{
print "inform user: Angelo";
...some other stuff...
}
The question now is, how to replace "Angelo" with a variable and call it from shell like:
sub inform_user{
my ($to)=@_;
print "inform user: $to";
}
This call does not work:
perl automated_mailing.pl inf("Brian")
How is this be done correctly?