> I've seen double-semicolons used in code examples from BrowserUk, but in that case I think it has some actual, functional use in his personal REPL.

some background for those still interested:

It's about how to deal with continuation lines, i.e. not to eval a single line but a chunk of lines, and how to signal what the author wants.

The standard Perl "REPL"¹, the debugger, has cumbersome way to signal continuation lines, one has to finish a line with a backspaceslash ²:

lanx@lanx-1005HA:~$ perl -de0 #... DB<1> while (1) {\ cont: print $x++;\ cont: last if $x >3;\ cont: } 0123 DB<2>

Other REPL's try to make the distinction by using more than one semicolon, b/c semicolons are safe from other interpretations and a natural choice at the end of the line.

I remember BUK talking about this. (IIRC only eval after two semicolons)

I personally patched the debugger in a way to only eval code without syntax error and to continue reading lines till all expressions are closed.

But after an unintended bug you might be trapped in an endless loop, that's why I added ;; as emergency exit.

lanx@lanx-1005HA:~$ ipl # ... DB<100> while (1) { print $x++ last if $x> 3; } ;; syntax error at (eval 22)[multi_perl5db.pl:644] line 2, near "++last " DB<101> while (1) { print $x++; last if $x> 3; } 0123 DB<102>

as you can see I "forgot" the semicolon after the second line and was trapped in an endless loop.

Others don't wont to rely on such a heavy tool like perl5db.pl and realize a simple REPL with less than 10 lines only.

HTH!

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

¹) quoted since the debugger doesn't print by default

²) typo corrected (thx to Midlifexis )


In reply to Re^4: What Is the Purpose of a Line with only Two Semi-Colons? (background) by LanX
in thread What Is the Purpose of a Line with only Two Semi-Colons? by 1nickt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.