in reply to Re: Calling a function that may not be there...
in thread Calling a function that may not be there...
Edited becuase as Dominus pointed out, I was incorrect, and I wanted to disentangle my two points.
If you simply wanted to call a bunch of subroutines in order you could be more clever:
my @funcs = (); push @funcs, sub { print "middle\n"; }, sub { print "bottom\n"; }; push @funcs, some_subroutine_that_returns_sub_refs(); foreach my $sub (@funcs) { &$sub; }
By passing the subroutine references around you can do lots of powerful things without depending on global subroutine names. It all depends on what you are really trying to do.
-ben
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Calling a function that may not be there...
by Dominus (Parson) on Mar 27, 2001 at 21:26 UTC |