use strict; use warnings; my @tests = qw/12 1a 4 -3 0 0.1 .1/; for (@tests) { print "$_ => "; no warnings qw/numeric/; if ($_ eq int($_) && $_ > 0) { print 'ok'; } else { print 'bad'; } print "\n"; } __END__ C:\Perl\test>perl int_test.pl 12 => ok 1a => bad 4 => ok -3 => bad 0 => bad 0.1 => bad .1 => bad