#!/usr/bin/perl use warnings; use strict; use feature qw(say); N: for my $n (2 .. 99) { for my $x (2 .. $n - 1) { next N if 0 == $n % $x; } say $n, ' is a prime number'; } for my $n (2 .. 99) { for my $x (2 .. $n - 1) { goto NOT_PRIME if 0 == $n % $x; } say $n, ' is a prime number'; NOT_PRIME: }