Loading ...
Sorry, an error occurred while loading the content.
 

Multi Dimensional Arrays

Expand Messages
  • harish sundararaj
    hi people i have a small problem.... i would like to know how to create 2 dimensional arrays in perl...i m not able to find this in any of the perl books.....
    Message 1 of 3 , Sep 1, 2004
      hi people
      i have a small problem....
      i would like to know how to create 2 dimensional
      arrays in perl...i'm not able to find this in any of
      the perl books.....
      Any good links or tutorials regarding this are
      welcomed...
      thanks in advance....
      Rgds
      Harish.

      =====
      HARISH.S





      __________________________________
      Do you Yahoo!?
      Yahoo! Mail is new and improved - Check it out!
      http://promotions.yahoo.com/new_mail
    • Ken Home
      Just declare two separate arrays. ... From: harish sundararaj To: perl_official@yahoogroups.com ; beginning_perl@yahoogroups.com Sent: Wednesday, September 01,
      Message 2 of 3 , Sep 1, 2004

        Just declare two separate arrays.

        ----- Original Message -----
        Sent: Wednesday, September 01, 2004 9:18 PM
        Subject: [beginning_perl] Multi Dimensional Arrays

        hi people
        i have a small problem....
        i would like to know how to create 2 dimensional
        arrays in perl...i'm not able to find this in any of
        the perl books.....
        Any good links or tutorials regarding this are
        welcomed...
        thanks in advance....
        Rgds
        Harish.

        =====
        HARISH.S




                   
        __________________________________
        Do you Yahoo!?
        Yahoo! Mail is new and improved - Check it out!
        http://promotions.yahoo.com/new_mail

      • WilliamGunther@aol.com
        Perl doesn t have true 2d Arrays. You can get the effect of one using references. @array = ( [1, 2, 3], [4, 5, 6], [7, 8, 9], ); print
        Message 3 of 3 , Sep 1, 2004
          Perl doesn't have true 2d Arrays. You can get the effect of one using references.
           
          @array = (
                          [1,    2,    3],
                          [4,    5,    6],
                          [7,    8,    9],
                         );
           
          print $array[0][0]; #prints 1
          #is equivalent to
          print $array[0]->[0];
           
          __END__
           
          For more information so perldoc perlref
           
          --
          -will
          http://www.wgunther.tk
          (the above message is double rot13 encoded for security reasons)

          Most Useful Perl Modules
          -strict
          -warnings
          -Devel::DProf
          -Benchmark
          -B::Deparse
          -Data::Dumper
          -Clone
          -Perl::Tidy
          -Beautifier
          -DBD::SQLite
        Your message has been successfully submitted and would be delivered to recipients shortly.