PBP: 007 Semicolons

The suggestion here is to place a semicolon after every statement.  I agree with this, even if it isn’t technically needed.  The only place I’ll skip it is if it is a function returning a constant value, and that’s all that is in the function, like this:


sub constant_thingy () { "thingy" };

If you’re defining a large block of those, having less punctuation is a fine thing.

But if you want to spell it out with a semicolon, or the explicit return and a semicolon, that’s good too.

Other than that one corner case, I find it solid advice.

 

Leave a Reply