in reply to How to call a sub-routine ref
assuming for a second you are talking about a reference such as
then you would call it thusly:| stuff before my $sref = \&foo | stuff after
where "arg1...argn" would be replaced by the arguments you want passed to the sub.| later &($sref)( arg1....argn); |
Here is a more complete example:
#!/usr/bin/perl -w use strict; my $sref=\&foo; &{$sref}; exit(0); sub foo { print "This is foo.\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to call a sub-routine ref
by greengaroo (Hermit) on Oct 19, 2012 at 20:36 UTC | |
by blue_cowdawg (Monsignor) on Oct 22, 2012 at 12:47 UTC | |
by greengaroo (Hermit) on Oct 22, 2012 at 14:27 UTC |