programming-examples/perl/Subroutine/Returning data from subroutines.pl

13 lines
277 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
# 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;
}