On Tue, Sep 24, 2002 at 01:43:50PM -0400, Zielfelder, Robert wrote: > .... > foreach $sub (@list_of_subs) { > &{$sub}; ##-- this is the part I am stuck on. This doesn't work > } > ....
This is called a soft reference, and soft references are generally a bad idea. However, it should work. I would suggest using a hash, where the keys of the has are $sub as above, and the values subroutine references. The code would then look something like this: my %subs = ( foo => sub { print "foo" }, bar => \&bar, ); foreach my $sub (@list_of_subs) { &$sub; # or $sub->(... arguments ...) } This is safer if @list_of_subs is coming from user input. It's also easier to verify; to determine if $sub is valid, simply check %subs for the key. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]