[pm-h] Interesting Blog Posts on Context & Array vs List
Uri Guttman
uri at stemsystems.com
Fri Feb 21 06:03:28 PST 2014
On 02/21/2014 08:13 AM, B. Estrade wrote:
> On Wed, Feb 19, 2014 at 2:35 PM, Mark Allen <mrallen1 at yahoo.com> 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, at b, at c, at 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
More information about the Houston
mailing list