in reply to simple array question
It seems that you are trying to assign a list to array @compass. Lists are surrounded by brackets, or parentheses if you prefer that term: (). Instead, you have used braces, which in this case create a reference to an anonymous hash, hence the warning messages.
So you need something more like this:
#!/usr/bin/perl use strict; use warnings; my @compass = ( ["NW", "N", "NE"], ["W", "center", "E"], ["SW", "S", "SE"], ); print $compass[0]->[1];
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: simple array question
by chromatic (Archbishop) on Jan 03, 2011 at 04:37 UTC | |
Re^2: simple array question
by tw (Acolyte) on Jan 03, 2011 at 03:40 UTC |
In Section
Seekers of Perl Wisdom