Juerd has asked for the wisdom of the Perl Monks concerning the following question:
The weird thing is, that if i put the hashref in the dereference, or if i have a single-layered $hashref, it doesn't show the warning. Why is perl showing a warning with the above script?#!/usr/bin/perl -wl use strict; my $hashref = { foo => { bar => 'xyzzy' } }; sub name_me { # Note: there is no $hashref->{foo}{foo} return \ $hashref->{foo}{foo}; } print ${ name_me() }; # Note: I narrowed it down to this code. The original code # was about 50 lines. Because this is just a fragment, I couldn't # think of a proper name for the sub. Sorry :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Autovivification not working?
by MZSanford (Curate) on Dec 20, 2001 at 14:47 UTC | |
|
Re: Autovivification not working?
by larryk (Friar) on Dec 20, 2001 at 14:49 UTC | |
|
Re: Autovivification not working?
by Juerd (Abbot) on Dec 20, 2001 at 16:33 UTC | |
by jepri (Parson) on Dec 20, 2001 at 19:27 UTC | |
by Juerd (Abbot) on Dec 20, 2001 at 19:41 UTC | |
by jepri (Parson) on Dec 20, 2001 at 19:55 UTC | |
by Juerd (Abbot) on Dec 20, 2001 at 20:04 UTC | |
|
Re: Autovivification not working?
by Juerd (Abbot) on Dec 20, 2001 at 14:53 UTC | |
by runrig (Abbot) on Dec 20, 2001 at 14:56 UTC |