programming-examples/perl/Subroutine/Returning data from subroutines.pl
2019-11-15 12:59:38 +01:00

13 lines
277 B
Perl

# Subroutines return the value of the last expression evaluated.
# Or you can use the return statement to clearly delineate the value you want returned from the subroutine..
#!/usr/bin/perl -w
$value = two();
print "Two is $value.\n";
sub two {
return 2;
}