#!/usr/bin/perl

#
# format of usage: isprime l u
#   l: integer, lower bound to search for primes
#   u: integer, upper bound to search for primes
#

if($#ARGV == 0) {
	print "Please include the number on the command line.\n";
} else {
	$l = $ARGV[0];
	$u = $ARGV[1];
	for($i = $l; $i <= $u; $i++) {
		$isprime = 0;
		for ($j = 2; $j < sqrt($i); $j++) {
			if($i % $j == 0) {
				$isprime = 1;
			}
		}
		if($isprime == 0) {
			print "$i is prime\n";
		}
	}
}
