pldanutz has asked for the wisdom of the Perl Monks concerning the following question:
Is there no way to say that f2 expects 2 scalars, but should accept an array of arguments just like any other Perl function?sub f1 { return $_[0] + $_[1] } sub f2 ($$) { return $_[0] + $_[1] } my @a = (1, 2); print f1 (@a) . "\n" #print f2 (@a) . "\n" # compile-time error with f2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing array of args to prototyped subs
by afoken (Chancellor) on Sep 10, 2013 at 05:24 UTC | |
by pldanutz (Acolyte) on Sep 10, 2013 at 05:35 UTC | |
by tobyink (Canon) on Sep 10, 2013 at 09:09 UTC | |
|
Re: passing array of args to prototyped subs
by boftx (Deacon) on Sep 10, 2013 at 05:24 UTC | |
by pldanutz (Acolyte) on Sep 10, 2013 at 05:38 UTC | |
by Athanasius (Archbishop) on Sep 10, 2013 at 06:39 UTC | |
by pldanutz (Acolyte) on Sep 10, 2013 at 08:31 UTC | |
by hdb (Monsignor) on Sep 10, 2013 at 09:14 UTC | |
by Laurent_R (Canon) on Sep 10, 2013 at 10:12 UTC |