... } else { print join(',', @$included, $nextValue), "\n" if $currentGoal == $nextValue; return if $nextValue >= $currentGoal; } ... #### ... } else { if ($currentGoal == $nextValue) { print join(',', @$included, $nextValue), "\n"; push @results, [@$included, $nextValue]; } return if $nextValue >= $currentGoal; } ...