On Jul 30, Robb Wagoner said:

>When I pass a reference to the array in a subroutine:
>
>       some_sub(\@array);
>
>What is the proper way to dereference the array with in the subroutine?

I do:

  some_sub([ [1,2,3], [4,5,6] ]);

  sub some_sub {
    my $aref = shift;
    print $aref->[0][0];  # 1
    print $aref->[1][2];  # 6
  }

I suggest you read

  perldoc perlreftut
  perldoc perlref
  perldoc perllol
  perldoc perldsc

Not all *MUST* be read, but the last two are definitely helpful for coming
up with ways of dealing with your structures once you've made them.  The
first two are definitely a good starting place, though.

I also have some documentation I wrote up:

  http://www.pobox.com/~japhy/docs/using_refs

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to