eval { foreach $i (1 .. 99) { if (bedingung1($i)) { problem_code(); } } 1; # Alles in Ordnung! } or do { warn "Exception: $@"; };