in reply to Re^4: uninitialized string variable
in thread uninitialized string variable

$ perl -wE '$data = [{"data" => "foo"}]; say @$data[0]->{"data"}' foo
However, I would write that as
$$data[0]{"data"}
which doesn't use an unneeded arrow, and uses the more usual dereference sigil. (I guess this case isn't caught by "Scalar value @... is better written as $...).

Replies are listed 'Best First'.
Re^6: uninitialized string variable
by choroba (Cardinal) on Aug 13, 2010 at 22:04 UTC
    Isn't it the same as $data->[0]{data} I'd use?

      From what I have tried it is the same thing (if you put "data") That does look cleaner. I was just doing it the way I learned how to. I like the cleaned up look though. Thanks

      $data->[0]{data} and $$data[0]{data} are equivalent. And so is $data->[0]->{data}. Use whatever you prefer.