- or download this
use 5.010;
given( $number ) {
...
when( /^[+-]?(?=\.?\d)\d*\.?\d*(?:e[+-]?\d+)?\z/i)
{ say "\tis a C float" }
}
- or download this
#!/usr/bin/perl
use strict;
...
print "The $number is a C float\n";
}
}
- or download this
The 1 is a whole number
The -1 has nondigits
The 123.1 has nondigits
The 0.1 has nondigits
- or download this
The 1 is a +/- integer
The -1 is a +/- integer
The 123.1 is a C float
The 0.1 is a C float
- or download this
my @numbers = ("1", "-1", "123.1", "0.1");
...
-1 is Float
123.1 is Float
0.1 is Float
- or download this
#!/usr/bin/perl
use strict;
...
The 123.1 is a C float
The 0.1 is a C float
The Characters has nondigits
- or download this
#!/usr/bin/perl
use strict;
...
The 123.1 is a C float
The 0.1 is a C float
The Characters has nondigits
- or download this
#!/usr/bin/perl
use strict;
...
Rate IfAndElsIfLoop SwitchLoop
IfAndElsIfLoop 4954766/s -- -13%
SwitchLoop 5691790/s 15% --