in reply to Float regex matching

I expect you can compare these two to see.

perl -le 'print "OK" if 0.0 =~ /^\d+$/' perl -le 'print "OK" if "0.0" =~ /^\d+$/'

Replies are listed 'Best First'.
Re^2: Float regex matching
by Anonymous Monk on Feb 24, 2016 at 16:21 UTC
    Looks like Perl resolves 0.0 to 0
      ... Perl resolves 0.0 to 0

      As davido points out below, Perl stringizes 0.0 to '0':

      c:\@Work\Perl\monks>perl -wMstrict -le "my $f = 0.0; my $fs = qq{$f}; print qq{stringization of 0.0: '$fs'}; ;; $f = 0.5; $fs = qq{$f}; print qq{stringization of 0.5: '$fs'}; " stringization of 0.0: '0' stringization of 0.5: '0.5'


      Give a man a fish:  <%-{-{-{-<