in reply to Re: hash problem
in thread hash problem

Are you sure it works? When I inspect your @hash with print Dumper(\@hash); all I get is $VAR1 = [];

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^3: hash problem
by sacked (Hermit) on Jul 09, 2004 at 18:37 UTC
    You want print Dumper \%hash, not \@hash.

    @hash{@keys} is a hash slice, not an array.

    --sacked
      In that case you get as result
      $VAR1 = { 'three' => undef, 'one' => undef, 'two' => undef };
      which isn't at all what the OP asked for.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re^3: hash problem
by sweetblood (Prior) on Jul 09, 2004 at 18:48 UTC
    perhaps I'm mistaken but I don't think so, try:
    print Dumper %hash
    If I'm wrong then I've mis-understood something

    Sweetblood

      IF you try that, Data::Dumper gives you:
      $VAR1 = 'three'; $VAR2 = undef; $VAR3 = 'one'; $VAR4 = undef; $VAR5 = 'two'; $VAR6 = undef;

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law