develooper Front page | perl.perl5.porters | Postings from September 2016

[perl #129177] No autovivification, for loop aliasing,

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
September 4, 2016 01:08
Subject:
[perl #129177] No autovivification, for loop aliasing,
Message ID:
rt-4.0.24-26354-1472951287-1993.129177-15-0@perl.org
On Sat Sep 03 17:26:00 2016, jkeenan wrote:
> On Sat Sep 03 15:00:21 2016, leszek@dubiel.pl wrote:
> >
> 
> Let me slightly rewrite what we've got so far in a more contemporary
> notation:
> 
> #####
> use Data::Dumper;$Data::Dumper::Indent=0;
> my $n = {};
> for (@{$n->{'x'}}) {
>         print 1;
> }
> print Dumper ($n), "\n";
> #####
> 
> Output:
> 
> #####
> $VAR1 = {'x' => []};
> #####
> 
> > # the same throws exception:
> > # Can't use an undefined value as an ARRAY reference
> > @{$$n{'y'}} and print 2;
> >
> 

Follow-up: Vincent Pit pointed on irc.perl.org #p5p that this exception is a consequence of your (correct) use of 'use strict;'.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: rejected
https://rt.perl.org/Ticket/Display.html?id=129177

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About