http://qs321.pair.com?node_id=11101938


in reply to Braces around a section of code

Hello thnksnw, and welcome to the Monastery!

Braces create a block, which has its own lexical scope. So you might do something like this:

{ my $foo = 42; # do more with $foo here } # $foo is no longer in scope here

to restrict the scope of $foo to only that part of the code where it ought to be used.

In the code shown, I can’t see any advantage to the braces. Is this the real code? If so, maybe the author was intending to add an if above it to remove the code from execution or even from compilation. For example,

use constant DEBUG => 0; ... if (DEBUG) { # This code will not be compiled }

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,