programming-examples/perl/Subroutine/Local variable shadows the global variable in a subroutine.pl
2019-11-15 12:59:38 +01:00

12 lines
190 B
Perl

#!/usr/bin/perl -w
$x = 10;
print "before: $x\n";
change_global_not();
print "after: $x\n";
sub change_global_not {
my $x = 20;
print "in change_global_not(): $x\n";
}