Using grep on undefined array
Avishalom Shalit
avishalom at gmail.com
Wed Aug 14 17:35:19 BST 2013
wait, aren't $a and $b special ?
(they magically live for {$a<=>$b} etc. )
-- vish
On 14 August 2013 04:07, William Blunn <bill+london.pm at blunn.org> wrote:
> On 14/08/2013 01:17, Adrian Lai wrote:
>
>> The use of @$fields is sufficient to autovivify $fields as an array ref.
>>
>
> Hmmm. Ish.
>
> /In the context of a parameter to grep/ (and even this may be a misleading
> condition), the use of @$fields is sufficient to autovivify $fields as an
> array ref.
>
> But in the general case, the use of @$fields may not autovivifiy $fields.
> Consider this:
>
> $ perl -E 'my $a; say q{@$a = }, @$a; say q{$a = }, $a;'
> @$a =
> $a =
>
> In this case @$a does not autovivify $a.
>
> Regards,
>
> Bill
>
More information about the london.pm
mailing list