in reply to Re: Dereferencing a hash ref in an array ref
in thread Dereferencing a hash ref in an array ref

I just meant that the dereferencing using for the array deref the curly brackets, and for the hash deref the dereferencing using the arrow syntax. I thought its better only to use the second one, but dont know how that have to look like.

Part 1:

@{$hashref}

Part 2 ("$hashref"):

$sth->{NAME_uc}

If thats already "pretty" (one syntax style for dereferencing) my thoughts just were wrong, would be an answer too.

Greetings, Schaelle

Replies are listed 'Best First'.
Re^3: Dereferencing a hash ref in an array ref
by Anonymous Monk on Mar 26, 2010 at 08:38 UTC
    :) use Anonymous::Monk; no ESP;

    References quick reference

    You can only get scalars using the arrow syntax, you cant get multiple values

    my $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , $sth->{NAME_uc}[0 ,1 ]; __END__ 2
    my $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , @$sth->{NAME_uc}[0 ,1 ]; __END__ Not an ARRAY reference at - line 3.
    That is why you need curlies
    my $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , @{ $sth->{NAME_uc} } [0 ,1 ]; __END__ 1 2
    The arrow-less way
    my $sth = { NAME_uc => [ 1 .. 2 ] }; print join "\n" , @{ $$sth{NAME_uc} } ,'' __END__ 1 2
    References quick reference