For subroutines with more than one argument:
sub mysub { return unless( (@_ % 2) == 0); my %args = ( host => 'localhost', port => 25, @_); # print "Args: host = $args{'host'}, port = $args{'port'}\n"; 1; } mysub( host => 'gatekeeper.dec.com', port => 80) or die "Mysub failed";
In reply to Re: Default subroutine parameters
by jeffenstein
in thread Default subroutine parameters
by thelenm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |