in reply to Re^4: Distinguish between missing and undefined arguments with subroutine signatures (semipredicate problem)
in thread Distinguish between missing and undefined arguments with subroutine signatures
Ah ... I see. Using a slurpy parameter @settings will solve this and fits much better into your use-case.
from perlsub
After positional parameters, additional arguments may be captured in a slurpy parameter. The simplest form of this is just an array variable:sub foo ($filter, @inputs) { print $filter->($_) foreach @inputs; }
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Distinguish between missing and undefined arguments with subroutine signatures (semipredicate problem)
by jo37 (Curate) on Dec 27, 2020 at 21:13 UTC | |
by LanX (Saint) on Dec 27, 2020 at 21:21 UTC | |
by LanX (Saint) on Dec 27, 2020 at 21:39 UTC | |
by jo37 (Curate) on Dec 27, 2020 at 21:53 UTC | |
by LanX (Saint) on Dec 27, 2020 at 21:59 UTC |