Hi Ben

"Ben Siders" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have a subroutine that will receive parameters as follows:
>
> key1, value1, key2, value2, key3, value3, ... keyN, valueN
>
> I want to create a hash of key1 => value1, key2 => value2, ... , keyN =>
> valueN in the subroutine.  I'm curious if there's a Perl "trick" to
> doing this beyond the obvious looping solution.

You may want to check first that the list has an even number of entries:

    die "Invalid parameters" if @_ % 2;

but after that it's just:

    %myHash = @_;

HTH,

Rob




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

Reply via email to