You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
435 B
Perl

# In your subroutines, you can access the value of any global variable.
# A global variable is a variable that is accessible across the entire Perl script.
# A subroutine can use data set up by other parts of your Perl scripts:
#!/usr/bin/perl -w
# Accessing global variables in subroutines.
$a = 1;
$b = 4;
$value = add();
print "$a plus $b is $value.\n";
sub add {
return ($a + $b);
}
# sub3.pl