On Feb 1, 2005, at 1:53 PM, Mark Martin wrote:
Hi,
okay - straight out of the coobook :
my @different = ()
foreach (keys %hash1)
{
delete $hash1{$_} unless exists $hash2$_};
push(@this_not_that,$_) unless exists $registered{$_};
}
easy to remove the different key from hash one and record the removed
item in @different.
My question is how would you record the removed item in another hash
so that it has the original key and corresponding value?
I've tried :
%different = ();
foreach $key (keys %hash1)
{
$value = $hash1{$key};
@different{$_} = $value unless exists $hash2{$_};
}
$different{$key} = $value unless exists $hash2{$key};
HTH
Remo
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>