Lee Goddard wrote:
> I have defined sub a1, sub a2, and sub a3.
> I need to push to an array references to these.
> Is there a way I can do this programmatically?
>
> Sortalike...
>
> for (1..3){
> push @myarray, \&a$_;
> }
>
> ...but correct?
Finally, a legitimate case for symbolic references? There might be a
cleaner syntax, but this should work:
sub a1 { print "a1\n" }
sub a2 { print "a2\n" }
sub a3 { print "a3\n" }
for( 1..3 ) { $name = "a" . $_; push @refs, \&$name }
# and to execute ...
for( 0..2 ) { &{$refs[$_]} };
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users