Thread Using a hash as a reference is deprecated (12 answers)
Opened by mika at 2012-11-03 14:54

mika
 2012-11-03 14:54
#163012 #163012
User since
2010-10-02
168 Artikel
BenutzerIn

user image
Hi,

obigen Hinweis bekomme ich bei folgendem Skript (/tmp/unbenannt):

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl
use warnings;
use diagnostics;

my %var = (foo=>"bar");

sub print_foo
{
        my $ref = shift;
        print %{$ref}->{foo};
}

print_foo \%var;


Aus dem Hinweis lesen heraus das dies nun wohl entfallen ist. Aber wie soll man das nun umsetzen?

Code: (dl )
1
2
3
4
5
6
7
8
$ perl /tmp/unbenannt 
Using a hash as a reference is deprecated at /tmp/unbenannt line 10 (#1)
(D deprecated) You tried to use a hash as a reference, as in
%foo->{"bar"} or %$ref->{"hello"}. Versions of perl <= 5.6.1
used to allow this syntax, but shouldn't have. It is now deprecated, and will
be removed in a future version.

bar

Last edited: 2012-11-03 14:57:02 +0100 (CET)

View full thread Using a hash as a reference is deprecated