#! /usr/local/bin/perl

for ($i = 0; ; $i++) {
    my $prime = 1;
    my $count = 2;

    while ($count < $i) {
        if ($i % $count == 0) {
            $prime = 0;
            last;
        }
        $count++;
    }

    if ($prime) {
        print "$i\n";
    }
}