sub BlaBla(){
my @inp=@_
while ($#inp > 0){
my $key  = shift;
my $value = shift;

$myHash{$key} = $value;
}
}




Sign L Rakhitha Malinda Karunarathne Web :- rakhitha.cjb.net Email
:[EMAIL PROTECTED] Rakhitha Malinda Karunarathne.
----- Original Message -----
From: "Ben Siders" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 14, 2003 10:57 PM
Subject: Question about creating a hash of key-value pairs based on sub
parameters.


> 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.
>
> For example:
>
> while ( some condition )
> {
> my $key  = shift;
> my $value = shift;
>
> $myHash{$key} = $value;
> }
>
> What's my exit condition?
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to