--- 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
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
--- 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
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{$
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