SPUG: Diff keys(%hast0) with keys(%hash1) both ways ?

Atom Powers atom.powers at gmail.com
Fri Apr 14 12:10:29 PDT 2006

I some values/checks that could be "clean", "dirty", or both and I
want to find out how often it is clean and/or dirty.
$cleantests{$check} holds the number if times a check was clean,
similarly $dirtytests{$check} is how many times a check was dirty.
Again, a check could be "clean" 5 times a "dirty" 16 times, or

I'm having problems finding the checks which are "clean" but not "dirty".

I have:
foreach my $check ( keys %dirtytests ) {
	if ($cleantests{$check}) {
		print DATA $check . ":" . $dirtytests{$check} . "_" .
$cleantests{$check} . "\n";
	} else {
		print DATA $check . ":" . $dirtytests{$check} . "_0\n";

But I also want to be able to do this for the $cleantests{$checks}
which are not dirty.
print DATA $check . ":0_" . $cleantests{$check} . "\n";

I could
my @clean = keys(%cleantests);
and somehow undef a check from the array when I am doing
keys(%dirtytests), but I don't know if you can remove a value from an
array without knowing it's index.

I can't undef($cleantests{$check}) because I need to use those value later.

Perfection is just a word I use occasionally with mustard.
--Atom Powers--

More information about the spug-list mailing list