Almost, but not quite.
sub foo(\@@) { my ($aref,@rest) = @_; }
is the prototype for push: push does not have two list parameters, because you cannot have more than one list parameter; it has an array parameter, which automatically gets passed as an array reference, followed by a list (the rest of the arguments).

If you really want to use prototypes for two arrays you should use \@\@, optionally followed by more arguments:

#!/usr/local/bin/perl -w use strict; my @a = qw(a b c d); my @b = qw(e f g h); my @c = qw(i j k l); sub test(\@\@@) { my ($a,$b,@rest) = @_; print "@$a\n@$b\nrest is @rest\n"; } test(@a,@b,@c); __END__ a b c d e f g h rest is i j k l

update: I should probably make clear that using prototypes in Perl is generally frowned upon except in exceptional circumstances. There are good reasons for this attitude, but let me just point out that in the above example you can accomplish the same result if you pass the arrays by reference explicitly, and it's shorter to create anonymous arrayrefs than to pass two arrays if you don't intend to use the arrays any other way:

test( [qw(a b c d)], [qw(e f g h)], qw(i j k l)); sub test { my ($a,$b,@rest) = @_; print "@$a\n@$b\nrest is @rest\n"; }
update2: fixed typo

In reply to Re^2: How to pass two lists to a sub? by Joost
in thread How to pass two lists to a sub? by YAFZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.