... for my $test ( @tests ) { if($mask & $byte{$test}) { # (updated: forgot this line initially) eval "\$t->$test() or die"; $mask ^= $byte{$test} if ( $@ ); } } ...