On 6/23/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
On Fri, 2006-23-06 at 17:19 +0300, Muttley Meen wrote:
> I searched around for a construct to permit for a block
> of code to be passed as parameter, but with no success.
That's because you can't pass a block of code, you can only pass a
reference to a block of code, or the text that can be compiled into code
via eval.
See:
perldoc perlref
perldoc perlsub
Nice and helpful lecture.
The code could be altered to mimic code block, so foo could
be called like:
foo {
print "depth 1.\n" ;
} "test" ;
All this if foo has the prototype
sub foo(&$)
The question that I have is why isn't it possible to have
the block reference as the second parameter, so foo would be called as :
foo "test" {
print "depth 1\n"
} ;
--
__END__
Just my 0.00000002 million dollars worth,
--- Shawn
"For the things we have to learn before we can do them, we learn by doing them."
Aristotle
* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>