Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Braces around a section of code

by Eily (Monsignor)
on Jun 26, 2019 at 13:33 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2020-06-01 17:22 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (5 votes). Check out past polls.