in reply to Re: Using Shift with Parameters in a subroutine
in thread Using Shift with Parameters in a subroutine

Just to be thorough,

my ($one, $two) = _@;

works once, but ignores the side effect of shift (removing the arguments from the @_ array).

As Marshall says, using a reference to an array would be the best way to deal with a lot of parameters, but if you wanted to, say, process two at a time, you could do

while (my ($one,$two) = splice @_, 0, 2) { #do something }
(you'll get an uninitialized value warning if you supply an odd number of parameters)

Replies are listed 'Best First'.
Re^3: Using Shift with Parameters in a subroutine
by perlron (Pilgrim) on Oct 25, 2014 at 17:59 UTC
    thanks. i didnt realise this earlier, about the impact on @_ .
    Do not wait to strike when the iron is hot! Make it hot by striking - WB Yeats