in reply to hash problem

@hash{@keys} = ();
HTH

Sweetblood

Replies are listed 'Best First'.
Re^2: hash problem
by CountZero (Bishop) on Jul 09, 2004 at 18:33 UTC
    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

      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

      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