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 haukex (Archbishop)
on Jun 30, 2019 at 09:44 UTC ( [id://11102153]=note: print w/replies, xml ) Need Help??


in reply to Braces around a section of code

As the others have already said, the blocks introduce a new scope, and there are quite a few things in Perl that are lexically scoped. Just to add some more to the list that haven't been mentioned yet: several pragmas, such as strict and warnings, are also lexically scoped, and there are a few (rare!) cases where one might want to temporarily disable parts of those pragmas for a very small block of code.

By the way, I would recommend properly indenting the inner blocks as well. perltidy can help.

Replies are listed 'Best First'.
Re^2: Braces around a section of code
by Tux (Canon) on Jun 30, 2019 at 12:23 UTC

    The inner block *might* have been indented properly by perltidy, but when it was done using tabs, it gets lost in the the cut-n-paste.

    I am not starting a discussin about leading whitespace here. I personally do not care at all, as long as it looks correct in my editor, you can mix tabs and spaces for my care. I more care about consistency and correct indentation (which seldom happens according to my own rules :P).


    Enjoy, Have FUN! H.Merijn

      Ah, good point, you are correct there is a mix of tabs and spaces in the original. But the innermost print appears to not be indented enough, so my comment still stands ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found