in reply to Re^4: How to capture the "isn't numeric" warning?
in thread How to capture the "isn't numeric" warning?

Even if bare blocks weren't allowed in Perl, you could just use a do { ... } block, or a for loop that only has one iteration.

Replies are listed 'Best First'.
Re^6: How to capture the "isn't numeric" warning?
by LanX (Saint) on Jun 16, 2019 at 12:43 UTC
    > for loop that only has one iteration.

    Side note: Actually that's pretty much how bare blocks are implemented

    perlsyn#Basic-BLOCKs

    > A BLOCK by itself (labeled or not) is semantically equivalent to a loop that executes once. Thus you can use any of the loop control statements in it to leave or restart the block

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      With the difference that some forms of the for loop also set $_ for you...
      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
        Yeah that's probably why it's normally compared to a one time while loop.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice