On Fri, 2006-23-06 at 13:01 -0400, Muttley Meen wrote:
> 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 :
Don't use prototypes. They were design for other things
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
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 compil
",\&bar);
It execute and get the results as:
Param1 = test
hello
From: "Muttley Meen" <[EMAIL PROTECTED]>
To: beginners@perl.org
Subject: How to pass a block of code, as a parameter to function.
Date: Fri, 23 Jun 2006 17:19:09 +0300
I searched around for a construct t
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 :
sub foo {
$p1 = shift ;
$p2 = shift ;
print "Param1 = $p1\n" ;
eval $p2 ;
}
foo("test") {
print "depth 1\n" ;
}
Param1 = test