It's probably better to use a reference to the subroutine instead of its name:
#!/usr/local/bin/perl use strict; use warnings; my $s = \&res; $s->(); sub res { print "hai"; }
edit: see also perlref
In reply to Re: How to call subroutines using variables ?
by Joost
in thread How to call subroutines using variables ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |