@_
$a="hello";
test_args($a, "world");
sub test_args{
my ($arg1, $arg2) = @_;
print "The first two args are $arg1 and $ar2\n";
}
@_ array is statically or
lexically scoped meaning that
$value = "hello";
my_value();
print " global value = $value \n";
sub my_value{
print "global value from in function = $value\n";
my $value = 2;
print "my value is $value";
}
global value from in function = hello my value is 2 global value = hello
$value = "original"';
tellme();
spoof();
tellme();
sub spoof{
local $value = "temporary";
tellme();
}
sub tellme(){
print "Current value is $value\n";
}
output:
Current value is original Current value is temporary Current value is original