[Pdx-pm] Hash reference depricated..
chromatic
chromatic at wgz.org
Tue Oct 17 16:53:46 PDT 2006
On Tuesday 17 October 2006 16:44, Russ Johnson wrote:
> From what I can see, the two routines here produce the same result.
>
> for my $key ( keys %$DATA ) {
> my $value = %$DATA->{$key};
> print OUTFILE "$key => $value\n";
> }
>
> while ( my ($key, $value) = each(%$DATA) ) {
> print OUTFILE "$key => $value\n";
> }
>
> Except, the first one results in "Using a hash as a reference is
> deprecated at ./script.pl line 85." The second runs without errors.
>
> Anyone see why?
%$DATA->{$key} is more or less equivalent to %somehash->{$key}, which is one
level of dereferencing too many.
-- c
More information about the Pdx-pm-list
mailing list