in reply to Re: How would I do an inplace edit, prepending
in thread How would I do an inplace edit, prepending '~foo' to every key of a hash? (was: How would I do an inplace edit, prepending)

I'd do:
%hash = map { ("~foo$_" => delete $hash{$_}) } keys %hash;


japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
Re: Re: Re: How would I do an inplace edit, prepending
by extremely (Priest) on Feb 10, 2001 at 03:34 UTC
    You know I ++ed that japhy and then decided that it was truly evil. OTOH at least it isn't in void context, eh? This helps the unclean feeling a bit:
    $hash{"~foo$_"} = delete $hash{$_} for keys %hash;

    --
    $you = new YOU;
    honk() if $you->love(perl)