On 02/21/2014 08:13 AM, B. Estrade wrote:
On Wed, Feb 19, 2014 at 2:35 PM, Mark Allen <[email protected]> wrote:

When subroutine signatures are released in 5.20, you'll be able to do

sub foo ($self, $foo, $bar, $baz) {
    $foo ||= 'default';
    $baz //= 0;

    ...;
}

Yay!



How will this behave if you call the method with foo(@a,@b,@c,@d) versus
foo(\@a,\@b,\@c,\@d) ?  Does list flattening still occur in this case
necessitating the use array references if you want to pass one array per
parameter?


sub calls always flatten into @_. the only way to pass individual arrays is by reference. prototypes (not recommended in most cases) do allow arrays to be parsed as single args but they are actually passed as references.

uri


--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to