我想批量存储 perl 的返回值。我该如何做到这一点?
Batch Code:
FOR /F "delims=" %%I IN ('perl.exe c:\TestProp1noRefCases.pl 859') DO set lineCase=%%I
echo !lineCase! ::Nothing is outputted
Perl Code:
use strict;
use warnings;
sub main1;
my $arg1 =shift;
main1($arg1);
exit;
sub main1
{
#Returns 1,2,3 Depending on testNum passed
my @gp1= (829,845,851,859,864,867);
my @gp2= (861,863,865);
# my @gp4= (826-828,830-839,843-844,847-850,852-854,860-862,883);
# my @gp3= (877-882,884);
my $val1=1;
my $val2=2;
my $val3=3;
my $val4=4;
if((grep /^$arg1$/,@gp1) || ($arg1 >=822 && $arg1<=824))
{
# print "$val1\n";
return $val1;
} elsif ((grep /^$arg1$/,@gp2) || ($arg1>=855 && $arg1<=858))
{
#print "$val2\n";
return $val2;
} elsif (($arg1==884) || ($arg1>=877 && $arg1<=882))
{
#print "$val3\n";
return $val3;
} else
{
#print "$val4\n";
return $val4;
}
}