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

Hmm... All right, so it looks like looks_like_number() is better. Usually when I read this forum or ask something, I always learn something and then something extra on top of that. In this case, I learned how to capture warnings, how to turn off warnings. (And don't laugh, my assumption was that you can't just create a block { ... } without having a "for" or "sub" or an "if" keyword in front of it. In other programming languages, you get an error if you just create a block with no keyword in front of it. In perl, this is allowed, and it is something that I just discovered. Lol)

Thank you for your informative answers!!!

  • Comment on Re^4: How to capture the "isn't numeric" warning?

Replies are listed 'Best First'.
Re^5: How to capture the "isn't numeric" warning?
by tobyink (Canon) on Jun 16, 2019 at 11:28 UTC

    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.

      > 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]
Re^5: How to capture the "isn't numeric" warning?
by LanX (Saint) on Jun 15, 2019 at 16:34 UTC
    your welcome! :)

    > I always learn something and then something extra on top of that

    That's why the monastery is so great!

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