#! /usr/bin/perl -w use strict; package prime; require Exporter; our @ISA = qw(Exporter); our @Export = qw(is_prime); our $Version = 1.00; sub is_prime { return 0 if int( $_[0] ) != $_[0]; return 0 if $_[0] == 1; return 0 if $_[0] % 2 == 0 && $_[0] != 2; my $limit = int( sqrt( $_[0] ) ) + 1; for ( my $l = 3; $l <= $limit; $l += 2 ) { return 0 if $_[0] % $l == 0; } return 1; } 1;