[tpm] grabbing 2 input params at a time?

Ilia Lobsanov samogon at gmail.com
Wed Apr 16 16:21:02 PDT 2008


You could also do:

while (my ($letter, $num) = splice @_, 0, 2 ) { push @letters,  
$letter; push @nums, $num; }

less concise, more verbose?

ilia.

On 16-Apr-08, at 7:12 PM, Fulko Hew wrote:

> Sorry, my brain has gone on vacation...
>
> Whats the easiest way to grab two parameters at a time, that were  
> passed
> into a subroutine?
>
> ie.
>
> mysub('a', 1, 'b', 2, 'c', 3);
>
> sub mysub {
>    while (@_) { push @letters, shift; push @nums, shift; }
> }
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm



More information about the toronto-pm mailing list