in reply to Programming in Perl without semicolon

Haha, well done :)

However, couldn't you just put every statement in a bare block in any Perl file to accomplish this? Good point, jdporter.

And you didn't even know bears could type.

  • Comment on Re: Programming in Perl without semicolon

Replies are listed 'Best First'.
Re^2: Programming in Perl without semicolon
by ikegami (Patriarch) on Jan 31, 2009 at 02:30 UTC

    You couldn't put next/last/redo in bare blocks either, at least not without adding labels. Bare blocks are loops that execute once.

    However, that's not a big issue because those commands are practically always used conditionally. Unlike bare blocks, if blocks aren't loops, so you can use if ($cond) { next } (but not { next if $cond }).

    If you do have an unconditional loop control command (e.g. { ...; redo }), label the loop (LOOP: { { ... } redo LOOP }) or use a unconditional if ({ { ... } if (1) { redo } }).

Re^2: Programming in Perl without semicolon
by jdporter (Paladin) on Jan 31, 2009 at 00:40 UTC

    Notice that he didn't use any my variables?

      Wait a couple seconds! What about use vars()? (ikegami's reply to a reply below made me think of it (because he had used it himself).)

      And you didn't even know bears could type.

        Hmmm, you should probably all have a look at
        Acme::Pythonic
        from Xavier Noria. There you only have to use one ';', namely in
        use Acme::Pythonic;
        :)
        Of course, there still would be semicolons in strings and regexes or other non-statement places... Best regards, Udo