So I figured out from folks on the list, Beginning
Perl, and some print statements that 
@list = (2 .. $input);

puts the range of numbers into an array, and that if I
stringified it, then it would put the entire range
into $list[0]

Now that I've figured that bit out, I went on to
remove all the even numbers from the list.  I got that
done with this:
foreach (@list)
{ 
 if ($_ % 2 != 0)
 {
  unshift(@primelist, $_);
  @primelist\n";        
 }
}

Now what I'd like to do to test whether or not I have
a prime number is to get at each element in
@primelist, and use the modulus operator on each
element against each element in @list.  For example:
$primelist[0] % $list[0]
$primelist[0] % $list[1]
$primelist[0] % $list[2]
$primelist[1] % $list[0]
$primelist[1] % $list[1]
$primelist[1] % $list[2]
$primelist[2] % $list[0]
$primelist[2] % $list[1]
$primelist[2] % $list[2]        

and if the result doesn't equal 0 for every test
except for against itself, then I want to unshift it
onto @primelist.

I thought I'd do this with nested foreach loops, but
that didn't seem to work.  Any ideas?
Thanks.

__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to