ozgurp has asked for the wisdom of the Perl Monks concerning the following question:
The following code puts references to sub functions into an array and calls them.
If I wanted to print @procs array;use strict; use warnings; sub a1 { print("a1\n"); } sub a2 { print("a2\n"); } my @procs = (\&a1, \&a2); foreach (@procs) { $_->(); }
how can i print the references in the @procs array?foreach (@procs) { print("$_\n"; } I get: CODE(0x1d4f9ec) CODE(0x1dc40b4)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: printing an array with references in it
by Missing Words (Scribe) on Jun 29, 2003 at 17:56 UTC | |
by yosefm (Friar) on Jun 30, 2003 at 15:12 UTC | |
Re: printing an array with references in it
by davorg (Chancellor) on Jun 29, 2003 at 13:26 UTC | |
Re: printing an array with references in it
by sgifford (Prior) on Jun 29, 2003 at 08:06 UTC | |
by ozgurp (Beadle) on Jun 29, 2003 at 09:13 UTC | |
by tilly (Archbishop) on Jun 29, 2003 at 11:23 UTC | |
Re: printing an array with references in it
by bart (Canon) on Jun 29, 2003 at 12:38 UTC | |
by tcf22 (Priest) on Jun 29, 2003 at 13:25 UTC | |
by Tomte (Priest) on Jun 29, 2003 at 14:22 UTC |
Back to
Seekers of Perl Wisdom