for my $teiler (2..(($i/2)+1)) { return 0 if $i % $teiler == 0; # Abbrechen wenn kein Rest bleibt }