How can I rid a Deprecated REF problem?

Discussion in 'Perl Misc' started by Ian Pellew, Nov 22, 2004.

  1. Ian Pellew

    Ian Pellew Guest

    Hi All;

    Why am I getting the perl -W complaint like:-
    [Thu Nov 18 22:44:07 2004] w: Using a hash as a reference is
    deprecated at w line 435.
    . . . . .

    from the likes of :-
    435: my $en = \%$t_xmlin->{$child}->{$tag_s};

    The process works OK, but I doubt I am future proof.

    I am after a REF to the XML::Simple structure like:-
    $VAR1 = {
    'our_tags' => {
    'idx_serno' => '10001',
    'serno' => {
    -> 'pt_' => {
    'atts' => '1',
    'edate' => '9912312359',
    . . . . .

    I go on to use $en like
    my $l_var = eval{$$en->{$comp_to}};

    Regards
    Ian
    Ian Pellew, Nov 22, 2004
    #1
    1. Advertising

  2. Ian Pellew

    Eric Amick Guest

    On 22 Nov 2004 15:58:01 -0800, (Ian Pellew)
    wrote:

    >Hi All;
    >
    >Why am I getting the perl -W complaint like:-
    >[Thu Nov 18 22:44:07 2004] w: Using a hash as a reference is
    >deprecated at w line 435.
    > . . . . .
    >
    >from the likes of :-
    >435: my $en = \%$t_xmlin->{$child}->{$tag_s};
    >
    >The process works OK, but I doubt I am future proof.
    >
    >I am after a REF to the XML::Simple structure like:-
    >$VAR1 = {
    > 'our_tags' => {
    > 'idx_serno' => '10001',
    > 'serno' => {
    >-> 'pt_' => {
    > 'atts' => '1',
    > 'edate' => '9912312359',
    > . . . . .


    I think you really want

    my $en = $t_xmlin->{$child}->{$tag_s};

    The value is already a reference to a hash, if I understand you
    correctly. It would be useful to show the values of $child and $tag_s.

    --
    Eric Amick
    Columbia, MD
    Eric Amick, Nov 23, 2004
    #2
    1. Advertising

  3. Ian Pellew

    Anno Siegel Guest

    Ian Pellew <> wrote in comp.lang.perl.misc:
    > Hi All;
    >
    > Why am I getting the perl -W complaint like:-
    > [Thu Nov 18 22:44:07 2004] w: Using a hash as a reference is
    > deprecated at w line 435.
    > . . . . .
    >
    > from the likes of :-
    > 435: my $en = \%$t_xmlin->{$child}->{$tag_s};


    Precedence -- the expression is parsed as

    \ ( %$t_xmlin->{$child}->{$tag_s});

    which gives you a scalar ref (and the warning).

    I'm not sure why you think you need all this de-referencing and
    referencing.

    my $en = $t_xmlin->{$child}->{$tag_s};

    Anno
    Anno Siegel, Nov 23, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Barney Barumba
    Replies:
    0
    Views:
    561
    Barney Barumba
    Jul 23, 2003
  2. Replies:
    0
    Views:
    337
  3. Replies:
    22
    Views:
    756
    peter koch
    Apr 30, 2008
  4. Replies:
    6
    Views:
    347
    James Kanze
    Apr 29, 2008
  5. Navindra Umanee

    strong ref from weak ref?

    Navindra Umanee, Feb 12, 2005, in forum: Ruby
    Replies:
    2
    Views:
    143
    Navindra Umanee
    Feb 12, 2005
Loading...

Share This Page