in reply to Bulk hash population order

Another cute way to do this is a hash-slice:
@bighash{'C', 'D'} = ('some new value', 4);
I think it's more efficient, but I haven't tested it.

Replies are listed 'Best First'.
Re^2: Bulk hash population order
by jbert (Priest) on Nov 27, 2007 at 14:30 UTC
    Yes, a hash slice (or a loop) is the way to go, imho.

    Assuming you have the new values you want in %newbits:

    @bighash{keys %newbits} = values %newbits;
    or
    $bighash{$_} = $newbits{$_} for keys %newbits;
    Note that keys and values use the same order, so the above works.