Re: Can't use string as a subroutine ref while "strict refs"

2007-02-28 Thread Tom Phoenix
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

Re: Can't use string as a subroutine ref while "strict refs"

2007-02-28 Thread Jason Roth
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

Can't use string as a subroutine ref while "strict refs"

2007-02-28 Thread Michael Gale
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