in reply to Re: simple array question
in thread simple array question

The [] brackets are used to create a list reference. A reference is a scalar ($ sigil), not an array (@ sigil). To understand references, have a look at perlref. You could get it to work by dereferencing the $compass reference, like this:

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $compass = [ ["NW", "N", "NE"], ["W", "center", "E"], ["SW", "S", "SE"] ]; print Dumper($compass); print $compass->[0][1];

Replies are listed 'Best First'.
Re^3: simple array question
by tw (Acolyte) on Jan 03, 2011 at 03:53 UTC
    thanks, also partly answers my question about the difference between { [ (.

    I think i need to do some more reading on this....