in reply to Thoughts on "one function, flexible arguments"?
I believe that this is taking TIMTOWDI a bit too far.
The most common form I have seen is a list of key-value pairs as the argument list. Using a hashref is generally done only in functions that have been retrofitted to accept keyword options where a hashref was previously forbidden in the argument list.
sub my_func { my %params = @_; print "Message received: " . $params->{message}; if ($params->{newline}) { print "\n" } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Thoughts on "one function, flexible arguments"?
by hornpipe2 (Sexton) on Sep 01, 2019 at 02:18 UTC |