in reply to Re^5: How to call subroutines using variables ?
in thread How to call subroutines using variables ?
Obviously I'm missing something key here. I have:
my @val = (\val_input,\val_input,\val_input,\val_input,\val_number,\v +al_date,\val_number,\val_filter); for my $i ( 0 .. $#list) { $code = $val[$i]; #which subroutine to call? ($sql{ $list[$i] }, $error) = $self->$code( $mand[$i], $self->query +->param($list[$i] )); if ( $error-> { msg } ) { push @errors, ucfirst($list[$i])." $error +->{ msg }" } }
Sounds like I need a no strict 'refs' block in there. Possibly:
} no strict 'refs'; $code = $val[$i]; }
But now I'm just speculating.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: How to call subroutines using variables ?
by chromatic (Archbishop) on Jun 10, 2007 at 17:32 UTC |