in reply to Delete keys in hash if they exist in another hash

Try:
foreach $k (keys %hash){ delete ($hash{$k}) unless exists $end{$k}; }

You were using $_ as the key to %end. You have not set $_ in the code you posted so it is unlikely to have a value that you want. This should clear the error.

Replies are listed 'Best First'.
Re^2: Delete keys in hash if they exist in another hash
by tachyon (Chancellor) on Nov 11, 2004 at 09:49 UTC
    s/unless/if/ to be pedantic, but the clue is right of course.
Re^2: Delete keys in hash if they exist in another hash
by tgolf4fun (Novice) on Nov 13, 2004 at 00:20 UTC
    Thanks so much, what do they say about hind sight, anyway this worked. I just never put $k in $end{}. I can sleep now, and only hope that someday I can gain enough knowledge to help someone as you have I.