Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: Tact and the Monastery

by Aristotle (Chancellor)
on Sep 22, 2002 at 03:43 UTC ( #199841=note: print w/ replies, xml ) Need Help??


in reply to Re: Re^4: Tact and the Monastery
in thread Tact and the Monastery

I --ed you in turn.

my $closure; { my $variable; $closure = sub { $variable = shift }; }

The inner block is now a closure. The $variable will NOT disappear at the end of the scope wherein it was defined. The outer naked block is just a naked block. A closure can only be dynamically constructed and is a block that preserves a variable beyond the scope it was defined in.

Your own example shows just a naked block. You have perfectly explained its virtues which I was already aware (and an advocate) of, and which I did not challenge in the first place. But there is no closure in your code. Please check your definitions.

Makeshifts last the longest.


Comment on Re^5: Tact and the Monastery
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://199841]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2015-07-07 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls