in reply to Re: remove lending figures
in thread remove lending figures

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"; }

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

    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"; }

        thanks, i appreciate

      > 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