use strict; while () { chomp; my $input = $_; tr/$, +//d; if (/^[-]?\d+$/) { print "Acceptable: '$input' -> $_\n"; } elsif (/^[-]?\d+\.[\d]+$/) { ## problem print "Acceptable: '$input' -> ", int $_, "\n"; } else { print "Not acceptable: '$input' -> $_\n"; } } __DATA__ +30 -400 +20,0 -300.02 $ -50.1 -$ 500 - $ 60 + $ 30.