当我通过几个潜艇传递一个变量时,它总是变成空的。为什么是这样 ?
sub Main {
my $myVariable = "Test string";
firstSub($myVariable);
}
sub firstSub {
my($myVariable) = @_;
my @array = `some command`;
secondSub(@array, $myVariable);
}
sub secondSub {
my(@array, $myVariable) = @_;
print $myVariable;
}
echo 将是 undef。