On 2/28/07, Michael Gale <[EMAIL PROTECTED]> wrote:
I am trying to do the following, do I need to remove the strict option
for
this to work or is there a better way ?
There is a better way.
my @actions = ( "ssh_login", "su_login", "su_logout", "ssh_logout", "cmds"
);
for
You could turn of strict refs for just that function if you want.
sub admin {
no strict 'refs';
}
Otherwise you could put valid function names in a hash and call it
based on that. Something like
my @fun = (ssh_login => \&ssh_login, su_login => \&su_login );
...
$fun->{$a}->();
-J
Hello,
I am trying to do the following, do I need to remove the strict option
for this to work or is there a better way ?
--snip--
sub admin {
my $term = shift;
my $host = shift;
my @actions = ( "ssh_login", "su_login", "su_logout", "ssh_logout", "cmds"
);
foreach my