Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Posts
    138

    Unanswered: I wrote code and it returns error. Why?

    I wrote code and it returns error. Why?
    Use strict vars;
    $array = [
    [a, b],
    [A, B, C],
    [x, x]];
    print $array [0][0];

  2. #2
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    print $array[0]->[0];
    board.perl-community.de - The German Perl-Community

  3. #3
    Join Date
    Nov 2002
    Posts
    207
    What output you are expecting / What you want to print?
    Pls. give an example.

    Cheers!

  4. #4
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    It looks like valexna wants to print an element of a "multidimensional" array, but valexna used the syntax like in Java or C++. In Perl there are no multidimensional arrays, but Arrays of Arrays. So you have to dereference the anonymous arrays...
    board.perl-community.de - The German Perl-Community

  5. #5
    Join Date
    Nov 2002
    Posts
    207

  6. #6
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    Thanks, that is a great chapter...
    board.perl-community.de - The German Perl-Community

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •