Lee Goddard wrote:

> Rubinow, Larry wrote:
> 
> > 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[$_]} };
> 
> It's dirty, ugly and very perl - I love it, thanks!
> 
> I'd been trying to do too much at once with push @refs, \&$a.$_;
> 
> Thanks again,
> lee

On further review, you can simplify the push line to 

        for( 1..3 ) { push @refs, \&{"a$_"} }

Much closer to your original attempt.  Shoulda seen that right away.
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to