in reply to Sad newbie question about Data::Dumper and array references..

No, it shouldn't, because $data is holding a reference to an array.
Try
print $data->[0];

Replies are listed 'Best First'.
Re: Re: Sad newbie question about Data::Dumper and array references..
by greenFox (Vicar) on Mar 23, 2001 at 13:10 UTC
    other than style is there a reason to prefer

    print $data->[0];

    over

    print @{$data}[0];

    --
    my $chainsaw = 'Perl';

      Nope

      I just find print $data->[0] looks more like dereferencing.

      not that i can think of. there might be others to correct me, though.

       print @{$data}[0] is too many bracey-curly-making-me-hit-shift characters. they perform the same tasks.

        Actually, @{$data}[0] and $data->[0] perform slightly different tasks. The former creates an array containing one element (hence the @ at the start), whilst the latter creates a scalar (hence the $ at the start).

      It becomes apparent with more complex data structures, such as AoAoAoAoAoAoA's or HoHoHoHoHoHoHoH's, or any mutant variation thereof.      $data->[0]->[1]->[3]->[1]->[41]->[6] over      ${${${${${${$data}[0]}[1]}[3]}[1]}[41]}[6] Unless you're really good at counting brackets, I'd stick with the C-style dereferencing via '->'