Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

How can i prevent perltidy from adding a semicolon after an ellipsis?

by karlgoethebier (Monsignor)
on Nov 18, 2017 at 18:47 UTC ( #1203753=perlquestion: print w/replies, xml ) Need Help??

karlgoethebier has asked for the wisdom of the Perl Monks concerning the following question:

Unfortunately... results in ...;. Thanks for any hint.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re: How can i prevent perltidy from adding a semicolon after an ellipsis?
by 1nickt (Abbot) on Nov 18, 2017 at 18:52 UTC

    Hi Karl, the doc for ... shows it used with a semi-colon, and it doesn't seem to cause an error for me ... what's the issue with the semi-colon?


    The way forward always starts with a minimal test.

      Ah, i see:

      karls-mac-mini:monks karl$ perl -E 'sub foo{...}; foo();' Unimplemented at -e line 1. karls-mac-mini:monks karl$ perl -E 'sub bar{...;}; bar();' Unimplemented at -e line 1

      Both are valid. I didn't know this.

      I didn't run perl -c on the concerning file and thought things went wrong.

      On the other hand: I don't want perltidy to change my valid code. Nitpicking, sure.

      Thanks and best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

        From the docs You can only use the elliptical statement to stand in for a complete statement.

        So the semicolon is needed, if the "yadda yadda" is followed by other statements.

        And a trailing semicolon in a functions body is certainly not bad style.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1203753]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2019-11-12 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (66 votes). Check out past polls.

    Notices?