Re: How to pass a block of code, as a parameter to function.

2006-06-23 Thread Mr. Shawn H. Corey
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

Re: How to pass a block of code, as a parameter to function.

2006-06-23 Thread Muttley Meen
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

Re: How to pass a block of code, as a parameter to function.

2006-06-23 Thread Mr. Shawn H. Corey
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

RE: How to pass a block of code, as a parameter to function.

2006-06-23 Thread Jeff Peng
",\&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

How to pass a block of code, as a parameter to function.

2006-06-23 Thread Muttley Meen
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