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

Referance of Arrawys of arrays

Expand Messages
  • Dukelow, Don
    I m doing my @lb10 = qw/lb10 lb20 lb30/; my @lb21 = qw/lb21 lb31 lb11/; my @lb32 = qw/lb32 lb12 lb22/; my @arrList = qw/@vmcdlb10 @vmcdlb21 @vmcdlb32/; &main
    Message 1 of 3 , Jan 8, 2008
    • 0 Attachment
      I'm doing
      my @lb10 = qw/lb10 lb20 lb30/;
      my @lb21 = qw/lb21 lb31 lb11/;
      my @lb32 = qw/lb32 lb12 lb22/;

      my @arrList = qw/@vmcdlb10 @vmcdlb21 @vmcdlb32/;

      &main (\@arrList)

      Sub main {
      my ($arrList) = @_;

      my $arr_count = @{$arrList};
      for (my $x = '0'; $x < $arr_count; $x++) {
      print "$arrList->[$x]\n";
      }
      }

      All I'm getting is the name of the three arrays printed out , I need the contents of the three arrays. Can some one tell me why? Also how do you get the length of a array from the an array referance? I know that "$arr_count = @{$arrList};" isn't the best way to do this.
      -----
      Don Dukelow
      HP License Team
      Hewlett-Packard Company
      Tel: 810-728-3388
      e-mail: dukelow@...
    • Peter L. Berghold
      ... Hash: SHA1 ... There s your trouble. The qw operator is interpreting those variable names as strings which is not what I understand you wanting to do.
      Message 2 of 3 , Jan 8, 2008
      • 0 Attachment
        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA1

        Dukelow, Don wrote:
        >
        > my @arrList = qw/@vmcdlb10 @vmcdlb21 @vmcdlb32/;
        >

        There's your trouble. The "qw" operator is interpreting those variable
        names as strings which is not what I understand you wanting to do.

        Something like:

        my @arrList = ( [@vmcdlb10],[@vmcdlb21], [@vmcdlb32] );

        oughta do it...

        - ----

        Peter L. Berghold Unix Professional
        Peter@... AIM: redcowdawg YIM: blue_cowdawg
        "Those who fail to learn from history are condemned to repeat it."
        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v1.4.5 (GNU/Linux)
        Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

        iD8DBQFHg5/hUM9/01RIhaARAmcbAKDBggDFbooFQ3qqRTw7dPXvqL5DCACgphG8
        crDQLNTwieYrAB3AF9iOrPk=
        =IUFz
        -----END PGP SIGNATURE-----
      • Dukelow, Don
        Thank you that helped but I also had to add a index for the sub array like. print $arrList- [$x][1] n ; I can live with this thanks again. ... Don Dukelow HP
        Message 3 of 3 , Jan 8, 2008
        • 0 Attachment
          Thank you that helped but I also had to add a index for the sub array like.

          print "$arrList->[$x][1]\n";

          I can live with this thanks again.

          -----
          Don Dukelow
          HP License Team
          Hewlett-Packard Company
          Tel: 810-728-3388
          e-mail: dukelow@...



          ________________________________
          From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Peter L. Berghold
          Sent: Tuesday, January 08, 2008 11:08 AM
          To: perl-beginner@yahoogroups.com
          Subject: Re: [PBML] Referance of Arrawys of arrays


          -----BEGIN PGP SIGNED MESSAGE-----
          Hash: SHA1

          Dukelow, Don wrote:
          >
          > my @arrList = qw/@vmcdlb10 @vmcdlb21 @vmcdlb32/;
          >

          There's your trouble. The "qw" operator is interpreting those variable
          names as strings which is not what I understand you wanting to do.

          Something like:

          my @arrList = ( [@vmcdlb10],[@vmcdlb21], [@vmcdlb32] );

          oughta do it...

          - ----

          Peter L. Berghold Unix Professional
          Peter@...<mailto:Peter%40Berghold.Net> AIM: redcowdawg YIM: blue_cowdawg
          "Those who fail to learn from history are condemned to repeat it."
          -----BEGIN PGP SIGNATURE-----
          Version: GnuPG v1.4.5 (GNU/Linux)
          Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

          iD8DBQFHg5/hUM9/01RIhaARAmcbAKDBggDFbooFQ3qqRTw7dPXvqL5DCACgphG8
          crDQLNTwieYrAB3AF9iOrPk=
          =IUFz
          -----END PGP SIGNATURE-----




          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.