#!/usr/bin/perl
sub t {
print "in t\n";
print "@_\n";
&s;
}
sub s {
print "in s\n";
print "@_\n";
}
t(1,2);
print "out\n";
print "@_\n";
Output:
in t
1 2
in s
1 2
out
As you see,&s output 1 2 when no parameter is passed. Is this a feature or a bug?
Tested version is 5.8.8.
Calling a subroutine using the
&NAME;syntax makes current@_visible to it. This is documented in perlsub:So, it’s definitely a feature.