return fib(@frame) unless($frame[0] >= 4000000); } sub count { my $increment = @_; if(($increment % 2) == 0) { $result = $result + $increment; } Another thing: When I do division by 2 and I'm looking for the remainder, I always use & 1 instead of % 2 like so: if(($increment & 1) == 0)