my %failed; if (CONDITION) { $failed{"name"} ++; }; # more checks .... return scalar keys %failed ? \%failed : ();