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}->();

-Jason

On 2/28/07, Michael Gale <[EMAIL PROTECTED]> wrote:
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 $a (@actions) {

        &show_log("Calling $a");
        my $check= &{$a};

        return(1) unless $check==0;
     }

}
--snip--

--
Michael Gale

Red Hat Certified Engineer
Network Administrator
Pason Systems Corp.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to