Is there an easier, more compact way to convert two arrays, on with
keys and the other with values, into a hash?
I have this sample code:
1 #!/usr/local/bin/perl -w
2
3 my $hash ;
4 my @keys =qw(col1 col2 col3);
5 @vals=qw(a b c);
6 for ($i=0; $i<=2 ; $i++)
Robert Citek wrote:
>
> Is there an easier, more compact way to convert two arrays, on with
> keys and the other with values, into a hash?
>
> I have this sample code:
>
> 1 #!/usr/local/bin/perl -w
> 2
> 3 my $hash ;
> 4 my @keys =qw(col1 col2 col3);
> 5 @vals=qw(a
On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
Close. You want a hash slice.
@[EMAIL PROTECTED] = @vals;
A marvelously Perlish construct.
http://danconia.org
Swet! Thanks a bunch.
Do you have a good reference which explains this? I've looked in
both the Camel and Llama books
Robert Citek wrote:
>
> On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
>
>> Close. You want a hash slice.
>>
>> @[EMAIL PROTECTED] = @vals;
>>
>> A marvelously Perlish construct.
>>
>> http://danconia.org
>
>
> Swet! Thanks a bunch.
>
> Do you have a good reference which explains t
On Jul 19, Robert Citek said:
On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
Close. You want a hash slice.
@[EMAIL PROTECTED] = @vals;
A marvelously Perlish construct.
http://danconia.org
Swet! Thanks a bunch.
Do you have a good reference which explains this? I've looked in b
Robert Citek wrote:
On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
Close. You want a hash slice.
@[EMAIL PROTECTED] = @vals;
A marvelously Perlish construct.
http://danconia.org
Swet! Thanks a bunch.
Do you have a good reference which explains this? I've looked in both
th
Scott R. Godin wrote:
> Robert Citek wrote:
>
>>
>> On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
>>
>>> Close. You want a hash slice.
>>>
>>> @[EMAIL PROTECTED] = @vals;
>>>
>>> A marvelously Perlish construct.
>>>
>>> http://danconia.org
>>
>>
>>
>> Swet! Thanks a bunch.
>>
>> Do yo
On Jul 20, 2005, at 6:01 AM, Jeff 'japhy' Pinyan wrote:
Will need to digest the above a bit more.
For more, please read
perldoc perldata
to learn about slices, and
perldoc perlreftut
to be introduced to references. Further reading is:
perldoc perlref
perldoc perllol
perldoc pe
Wiggins d'Anconia wrote:
Scott R. Godin wrote:
On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
Close. You want a hash slice.
@[EMAIL PROTECTED] = @vals;
A marvelously Perlish construct.
basically it's shorthand for the more obvious and well documented
@{$reference} notation.
[snip]