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,6 @@
sub dofruit {
$fruit='apple';
}
dofruit;
print "The fruit is $fruit";

View file

@ -0,0 +1,10 @@
my $x = @a; # Scalar assignment; $x is set to the
# number of elements in @a.
my ($x) = @a; # List assignment; $x is set to the first
# element of @a.
my @b = @a; # List assignment; @b becomes the same length
# as @a and each element becomes the same.
my ($x, $y, @b) = @a; # List assignment; $x and $y get the first
# two elements of @a, and @b the rest.
my ($x, $y, @b, @c, $z) = @a; # Same thing, and also @c becomes empty
# and $z undefined.

View file

@ -0,0 +1,3 @@
use strict;
our $fruit; # declare a variable as global
our $veg = "carrot"; # declare a global variable and define its value

View file

@ -0,0 +1,10 @@
$fruit="apple"; # this will be global by default
sub dofruit {
print "My global fruit was $fruit,"; # use the global variable
my $fruit="banana"; # declare a new local variable
print "and the local fruit is $fruit.\n";
}
dofruit;
print "The global fruit is still $fruit";