A case of autovivification for you, I suspect...
 On May 11, 2011 10:49 PM, "Ludwig Isaac Lim" <[email protected]> wrote:
> Hi:
>
>       A question for curiosity's sake:
>
>      here's a snippet of code:
>
>     use warnings;
>
>      my $ref = undef;  # in real code is a function that just returned
undef
>
>     foreach my $item (@{$ref}) {
>     }
>
>      print $ref;
>
>
>      Expected output:
>       use of uninitialized value $ref in string
>
>
>     What I got:
>     ARRAY(<arbitrary address>)
>
>    I know I can wrap the "foreach" with "if defined ($ref)" statement, but
I like to know why
>
> Regards,
> Ludwig
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to