我是相当新的perl,所以很抱歉,如果这是一个新手问题。Perl子程序返回一个空值
据我了解Perl中,我可以这样做:
sub BuildAndroidRessourceArgument()
{
my @xmlResFiles = @_;
my $fileCnt = @_;
my $index = 0;
my $aaptResArg = "-F ";
foreach(@xmlResFiles)
{
$index = $index + 1;
if($index == $fileCnt)
{
$aaptResArg = $aaptResArg.$_;
}
else
{
$aaptResArg = $aaptResArg.$_." -F ";
}
}
print "$aaptResArg\n";
return($apptResArg);
}
当我打印我的aaptResArg在这里我有正确的值,但随后:
my ($aaptResArg) = BuildAndroidRessourceArgument(@xmlResFiles);
print "$aaptResArg\n";
当我回来后打印它没有打印任何值。
因此,据我所知,这段代码应该可以工作,如果它在函数中打印时没有理由为什么在返回值时不应该打印?
[?为什么要用严格和警告(http://stackoverflow.com/questions/8023959/why-use-strict-and-警告) – TLP 2011-12-15 15:22:39