Re: pushing into a hash

2001-07-26 Thread Paul
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > On Thu, Jul 26, 2001 at 05:27:28PM -0700, Paul wrote: > > sub pushHash (\%@) { # somebody please check that prototyping > > > local *INHASH = shift; > > This is clever, but should probably be avoided (mostly because it's > clever). lol -- t

Re: pushing into a hash

2001-07-26 Thread Michael Fowler
On Thu, Jul 26, 2001 at 05:27:28PM -0700, Paul wrote: > sub pushHash (\%@) { # somebody please check that prototyping > local *INHASH = shift; This is clever, but should probably be avoided (mostly because it's clever). > my %tmpHash = ( @_ ); > @INHASH{keys %tmpHash} = value

Re: pushing into a hash

2001-07-26 Thread Paul
--- Mooney Christophe-CMOONEY1 <[EMAIL PROTECTED]> wrote: > Does anyone know of a slick way to put an array into a hash? > > For example, given > > %a= > ( > -a => 1, > -b => 2, > -c => 3 > ); > @b=qw/-x 24 -y 25 -z 26/; > > Is there a nice way to merge the hash implied by @b

Re: pushing into a hash

2001-07-26 Thread Michael Fowler
On Thu, Jul 26, 2001 at 04:52:28PM -0400, Jeff 'japhy/Marillion' Pinyan wrote: > On Jul 26, Mooney Christophe-CMOONEY1 said: > > >@b=qw/-x 24 -y 25 -z 26/; > > > >Is there a nice way to merge the hash implied by @b into %a to get > > while (@b) { > my ($k, $v) = splice @b, 0, 2; > $a{$

Re: pushing into a hash

2001-07-26 Thread Jeff 'japhy/Marillion' Pinyan
On Jul 26, Mooney Christophe-CMOONEY1 said: >@b=qw/-x 24 -y 25 -z 26/; > >Is there a nice way to merge the hash implied by @b into %a to get while (@b) { my ($k, $v) = splice @b, 0, 2; $a{$k} = $v; } You could write %a = (%a, @b); but that's potentially slow and ugly. -- Jeff