このプログラムは、やり直しのエラーをスローします。これを解決するにはどうすればよいですか
use strict;
use warnings;
use Switch::Plain;
my %data = (0 => "Enter the number",1 => "UPC",2 => "URL", 3 => "Elastic Search", 4 => "API", 5 => "MONGO", 6 => "TSV", 7 => "SQL", 8 => "JSON", 9 => "Enter the correct value");
my $input = "Enter the number:";
sub input(){
print "Choose You Input Method"."\n";
print "1.UPC"."\n";
print "2.URL"."\n";
print "3.Elastic Search"."\n";
print $input;
PROMPT: {
chomp(my $input = <>);
nswitch($input){
case 1 : {print "UPC"."\n"}
case 2 : {print "URL"."\n"}
case 3 : {print "Elastic Search"."\n"}
default: {"Enter the correct value"; redo PROMPT }
}
}
}
input();
my $pinput = "Enter the number:";
sub pinput(){
print "Choose Your Process Method"."\n";
print "1.API"."\n";
print "2.Mongo"."\n";
print $pinput;
$pinput = <>;
chomp($pinput);
nswitch($pinput){
case 1 : {print "API"."\n"}
case 2 : {print "MONGO"."\n"}
default : {print "Enter the correct value"."\n"}
}
}
pinput();
スローされるエラーは
Argument "" isn't numeric in numeric eq (==) at framework.pl line 21, <> line 1
ユーザーが空の値または 4 を入力した場合など、使用された入力に不一致がある場合、サブルーチンを繰り返すという考え方です。
解決するために私を助けてください?