RosettaCodeData/Task/Scope-modifiers/Perl/scope-modifiers-1.pl
2023-07-01 13:44:08 -04:00

9 lines
212 B
Perl

use strict;
$x = 1; # Compilation error.
our $y = 2;
print "$y\n"; # Legal; refers to $main::y.
package Foo;
our $z = 3;
package Bar;
print "$z\n"; # Refers to $Foo::z.