[Moscow.pm] Интератор инициализирует ссылку на массив/хеш

Andrew Shitov andy на shitov.ru
Пт Сен 30 06:41:05 PDT 2011


http://stackoverflow.com/questions/6419618/perl-vivification-question-while-dereferencing-undefined-array-reference

2011/9/30 Alexander Onokhov <ccnweb на gmail.com>:
>
>
> On Fri, Sep 30, 2011 at 4:26 PM, Andrew Shitov <andy на shitov.ru> wrote:
>>
>> Потому что $t1 станет другим после foreach, а $t2 не станет :-)
>>
>> $ perl -E'use strict; use Data::Dumper; my $t; print Dumper($t); for
>> (@$t) {}; print Dumper($t);'
>> $VAR1 = undef;
>> $VAR1 = [];
>>
>
>
> В том и вопрос, почему $t1 позволено стать другим, а $t2 не позволено
>
> --
> Alexander
>
> --
> Moscow.pm mailing list
> moscow-pm на pm.org | http://moscow.pm.org
>
>



-- 
Andrew Shitov
______________________________________________________________________
andy на shitov.ru | http://shitov.ru


Подробная информация о списке рассылки Moscow-pm