Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Braces around a section of code

by Eily (Monsignor)
on Jun 26, 2019 at 13:33 UTC ( [id://11101939]=note: print w/replies, xml ) Need Help??


in reply to Braces around a section of code

There are many good reasons to do that, none of which apply here :P

It could be to limit the scope of a variable, eg to make sure that a filehandle is closed and destroyed when you are done using it. But there's no variable limited to the scope of that block. And it looks like the variables used or not lexical (my) anyway, since the loop variable which should be limited to the loop is not.

It could to separate the code logically, and make it easier to read. But here the indentation it very unhelpful so I doubt that this was a concern. Edit: the comment at the top might be to describe the whole block though?

A single block also works like a loop that is executed once. So the keywords redo (which goes back to the start of the block), next and last (both of which jump to the end of the block) can be used. But this is not the case here.

So my guess here would be that there used to be a condition or function which was removed, but not the corresponding block. Or some other unintentional reason.

Edit: ++Discipulus for mentioning local as well. There's also lexically scoped pragmas (like autodie) whose effect only applies inside the current block. But there's no use statement here, so that's still not the reason.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 01:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found