On 2012-03-30 12:33, Eko Budiharto wrote:

I would like to ask about 2 dimensional array

Each element of a Perl array is a scalar.


  my @colors = ( "red", "white", "blue" );

which can also be written as:

  my @colors = qw( red  white  blue );

and can be used as:

  print "ok" if $colors[ 2 ] eq "blue";


An array-reference is a scalar:

  my @colors_2d = (
    [ qw( red    white  blue  ) ],
    [ qw( black  red    green ) ],
  );

  print "ok2" if $colors_2d[ 0 ][ -1 ] eq "blue";

--
Ruud

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to