Thanks Darren!


I *knew* there was an easy way to do it! I rarely use slices that way
so I can see why it hadn't occured to me.

Oh, and yes, $scaOne and $scaTwo have the same number of fields in them.


Glenn

Glenn Tillema                  [EMAIL PROTECTED]
ADC Telecommunications, Inc.  
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com

> -----Original Message-----
> From: darren chamberlain [mailto:[EMAIL PROTECTED]]
> Subject: Re: Two Array into One Hash
> 
> The easy way to do this is to split $scaOne and $scaTwo and use
> them in a hash slice:
> 
>   $scaOne = "1,2,3,4,5";
>   $scaTwo = "label one,labelTwo,label,label4,label five";
> 
>   @one = split /,/, $scaOne;
>   @two = split /,/, $scaTwo;
> 
>   @h{@one} = @two;
> 
> Or, more succicntly, replace the last three lines with:
> 
>   @h{split ',', $scaOne} = (split /,/, $scaTwo);
> 
> This requires that $scaOne and $scaTwo have the same number of
> fields in them (but your problem suggests that they will).
> 
> (darren)

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

Reply via email to