in reply to Re: $_ functions vs argument-using functions
in thread $_ functions vs argument-using functions
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: $_ functions vs argument-using functions
by LanX (Saint) on Sep 09, 2013 at 19:12 UTC | |
by tobyink (Canon) on Sep 09, 2013 at 21:26 UTC | |
by LanX (Saint) on Sep 09, 2013 at 21:44 UTC | |
by tobyink (Canon) on Sep 09, 2013 at 22:40 UTC | |
by Laurent_R (Canon) on Sep 09, 2013 at 22:36 UTC | |
by pldanutz (Acolyte) on Sep 09, 2013 at 19:23 UTC | |
by LanX (Saint) on Sep 09, 2013 at 19:31 UTC | |
|
Re^3: $_ functions vs argument-using functions
by afoken (Chancellor) on Sep 10, 2013 at 05:07 UTC | |
by LanX (Saint) on Sep 10, 2013 at 10:30 UTC |