I understand that the prototype sub f ($) {} makes sure f is called with exactly one argument. I know I can't have formal args, but can use my ($a, $b) = @_ instead (or shift @_)
I know what $_ is used for, the way it gets its value in while (<>) and the way it is used implicitly in m/PATTERN/ and chomp. But I see that it can be used instead of function arguments (e.g. map prefers such functions). And I was asking if that was a preferred style.
In reply to Re^2: $_ functions vs argument-using functions
by pldanutz
in thread $_ functions vs argument-using functions
by pldanutz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |