I searched around for a construct to permit for a block
of code to be passed as parameter, but with no success.
The thing that I'm after is this :
<code>
sub foo {
$p1 = shift ;
$p2 = shift ;
print "Param1 = $p1\n" ;
eval $p2 ;
}
foo("test") {
print "depth 1\n" ;
}
</code>
<output>
Param1 = test
depth 1.
</output>
The closest thing I managed, was to pass the block as an array,
but the syntax gets strange and hard to follow.
foo("test", [ print "depth 1\n" ] )
Any suggestions ?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>