sub prototyped($_;$)
{
# Here $_[0] is a compulsory argument
# $_[1] defaults to $_
# $_[2] may not even exist
}
sub unprototyped
{
push @_, $_ if @_ < 2;
# Here $_[0] is a compulsory argument
# $_[1] defaults to $_
# $_[2] may not even exist
}
####
sub unprototyped
{
goto &unprototyped @_, $_ unless @_ > 1;
# See comments in previous exemples
}
####
sub unprototyped
{
push @_, $_ if @_ < 2;
# Do all the work
$_ = $_[-1];
# Return value here
}
####
use v5.14;
sub f2
{
while () { chomp; last; };
}
sub f1(_)
{
f2;
say shift;
}
f1 "Hello ";
$_ = "World";
f1;
f1 for "!";
__DATA__
Everyone
Perlmonks