Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,9 @@
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.

View file

@ -0,0 +1,13 @@
package Foo;
my $fruit = 'apple';
package Bar;
print "$fruit\n"; # Prints "apple".
{
my $fruit = 'banana';
print "$fruit\n"; # Prints "banana".
}
print "$fruit\n"; # Prints "apple".
# The second $fruit has been destroyed.
our $fruit = 'orange';
print "$fruit\n"; # Prints "orange"; refers to $Bar::fruit.
# The first $fruit is inaccessible.

View file

@ -0,0 +1,10 @@
use 5.10.0;
sub count_up
{
state $foo = 13;
say $foo++;
}
count_up; # Prints "13".
count_up; # Prints "14".

View file

@ -0,0 +1,17 @@
our $camelid = 'llama';
sub phooey
{
print "$camelid\n";
}
phooey; # Prints "llama".
sub do_phooey
{
local $camelid = 'alpaca';
phooey;
}
do_phooey; # Prints "alpaca".
phooey; # Prints "llama".