use strict; use warnings; my($a, $b) = (<>, <>); my $ans = 'OK'; if($a > 12345 or $b > 12345){ $ans = 'NG'; } if($a =! m/\d/g or $b =! m/\d/g){ $ans = 'NG'; } if($a =~ m/0\d/ or $b =~ m/0\d/){ $ans = 'NG'; } print $ans;