in reply to remove lending figures

just do int($whatever) since you probably don't use warnings anyway

disclaimer: lazy question, lazy answer

Replies are listed 'Best First'.
Re^2: remove lending figures
by frank1 (Monk) on Sep 18, 2025 at 19:22 UTC

    Thanks, i think this will help me int($whatever)

    because i did some little demonstration and works good

    $string = "1.00"; if (int ($string > 1)) { print "Yes true"; } else { print "Not true"; }

      tho with 1:00, isn't working

      am getting this error Argument "1:00" isn't numeric in numeric gt (>) at HelloWorld.pl line 4.

      $string = "1:00"; if (int ($string > 3)) { print "Yes true"; } else { print "Not true"; }

        int( $string > 3 ) should be int( $string ) > 3.

        You'll still get the warning unless you turn it off, though.

        my $string = "1:00"; if ( do { no warnings qw( numeric ); int( $string ) } > 3 ) { say ">= 4"; } else { say "< 4"; }

        It would be clearer to use >= 4 than > 3. And if you do that, you don't even need int.

        my $string = "1:00"; if ( do { no warnings qw( numeric ); $string >= 4 } ) { say ">= 4"; } else { say "< 4"; }
        > tho with 1:00, isn't working

        Because ":" is not "."

        Use  @digits = split /[:.]/, $string

        And pick what you need

        For anything more complicated, better consider a dedicated DateTime module.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery