in reply to Re^3: How to declare arrays and scalars together?
in thread How to declare arrays and scalars together?

That is my point. It is possible to pass multiple arrays, using array reference.

  • Comment on Re^4: How to declare arrays and scalars together?

Replies are listed 'Best First'.
Re^5: How to declare arrays and scalars together?
by Anonymous Monk on Jun 19, 2012 at 01:59 UTC

    That is my point. It is possible to pass multiple arrays, using array reference

    Well, you missed the point of Re: How to declare arrays and scalars together? which is, you're only passing lists, you cannot pass an array, an array and an arrayref aren't identical, you need to de-reference an arrayref, but not an array

    Given my @one = (1,1); my @two = (2,2);

    This  foo( @one, @two ); is basically the same as  foo( 1,1,2,2 );

    With the appropriate prototype  foo( @one, @two ); could also be basically the same as  foo( \@one, \@two );

    If you use  foo( \@one, \@two ); then in sub foo you would need to write     my( $oneref, $tworef ) = @_; which is not the same as  my( @one, @two ) = @_;

    You're always passing lists to subroutines