#! perl -sw use strict; my %foo = ( aa => { O => 'zz', C => 'yy' }, bb => { O => 'xx', C => 'xx' }, cc => { O => undef, C => 'ww' }, dd => { O => 'vv', C => undef }, ee => { O => undef, C => undef }, ff => { C => undef }, gg => { O => 0, C => 0 }, hh => { O => undef, C => 0 }, ); sub BUK{ local($^W,$a)=(0,pop); grep{!exists$a->{$_}{O}or$a->{$_}{O}ne$a->{$_}{C}}keys %$a; } sub snw{ no warnings qw(uninitialized); my$h=pop; grep{$h->{$_}{O}ne$h->{$_}{C}}keys %$h; } sub sg_{ my$h=pop; # defined($x &&$y) &&$x eq$y grep{!(defined($h->{$_}{O}&&$h->{$_}{C})&&$h->{$_}{O}eq$h->{$_}{C} # ||!defined($x ||$y) ||!defined($h->{$_}{O}||$h->{$_}{C}))}%$h; } sub eg_{ my$h=pop; # (($x ||$;)eq($y ||$;)) grep{!(($h->{$_}{O}||$;)eq($h->{$_}{C}||$;))}%$h; } =pod sub ag_{ my$h=pop; grep sub{(1==grep defined,@_)or($_[0]ne$_[1])} ->(values @{$h->{$_}}['O','C']), keys %$h; } Type of arg 1 to values must be hash (not array slice) at C:\test\201391.pl line 26, near "])" =cut print " Required: dd ff aa hh cc\n"; print "-------------------------------\n"; print "BrowserUK golf: @{[BUK(\%foo)]}\n"; print "sauoq No warns: @{[snw(\%foo)]}\n"; print " Sauoq golf: @{[sg_(\%foo)]}\n"; print " Elusion golf: @{[eg_(\%foo)]}\n"; #print "Aristotle golf: @{[ag_(\%foo)]}\n"; =pod It seemed to me that the biggest problem with the original problem was the method of recording the old versus changed hash--by adding an extra key. Better I think to uses two hashes, %old and %change (or %o %o here). That makes the problem of noting the changes somewhat clearer I think. Though it does little better in the golf stakes. =cut my %o=(aa=>'zz', bb=>'xx', cc=>undef, dd=>'vv', ee=>undef, gg=>0, hh=>undef,); my %c=(aa=>'yy', bb=>'xx', cc=>'ww', dd=>undef, ee=>undef, ff=>undef, gg=>0, hh=>0,); sub comp{ local($^W, $a, $b)=(0, @_); grep{!exists$a->{$_} or $a->{$_} ne $b->{$_} } keys%$b; } print " BUK2 golf: @{[comp(\%o,\%c)]}\n";