convert array pair to hash

2005-07-19 Thread Robert Citek
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++)

Re: convert array pair to hash

2005-07-19 Thread Wiggins d'Anconia
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

Re: convert array pair to hash

2005-07-19 Thread Robert Citek
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

Re: convert array pair to hash

2005-07-19 Thread Wiggins d'Anconia
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

Re: convert array pair to hash

2005-07-20 Thread Jeff 'japhy' Pinyan
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

Re: convert array pair to hash

2005-07-20 Thread Scott R. Godin
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

Re: convert array pair to hash

2005-07-20 Thread Wiggins d'Anconia
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

Re: convert array pair to hash

2005-07-20 Thread Robert Citek
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

Re: convert array pair to hash

2005-07-21 Thread Scott R. Godin
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]