On 2005-06-20, at 07:02:38 -0700, Will Lowe wrote:
> > Only this isn't ever going to work because there's no way in pure perl that
> > you can create such a structure - what it writes doesn't work because
> > $VAR1 doesn't have a value at the point of assignment, and even if it wrote
> > the fixup after the initial creation of $VAR1 as:
> >
> > $VAR1->{'4'} = ${\$VAR1->{'3'}};
> >
> > because the hash assignment does a copy, not a binding.
>
> But if I do this in Perl:
>
> $VAR1->{3} = undef;
> $VAR1->{4} = undef;
>
> Data::Dumper understands it just fine. Aren't the values aren't both
> set to PL_sv_undef (and if so why doesn't it confuse Data::Dumper)?
> Or does Perl make a copy of PL_sv_undef and set the values to the
> copies? I thought the point of the global variables was to avoid
> making copies in situations like this ...
You should probably also have a look at:
http://search.cpan.org/~nwclark/perl/pod/perlguts.pod#AVs,_HVs_and_undefined_values
Marcus
--
In general, they do what you want, unless you want consistency.
--Larry Wall in the perl man page