in reply to order of operations with conditionals at the end

There are a couple of problems that I see. First, unless not is the same as if. Second, you have an undefined subroutine in isBad.
#!/usr/bin/perl -l use strictures 1; no strict 'refs'; use Devel::SimpleTrace; print my $message = 'Congrats' if defined ${'result'}; my @badVals; foreach my $val (my(@vals)) { push @badVals, $val && next if isBad($val); print "$val is a good val"; } sub isBad {...}