> That's not really accurate.  What was said to that:
> 
> @list = "@list";
> 
> Creates a joined string of elements and replaces the
> list with that one 
> item.  It's perfectly reasonable to stringify an
> array, without 
> altering the array's contents:
> 
> print "@list\n";
> 

I'm not sure I understand.

> 
> That can just be if ($_ % 2), if you prefer.  Zero

That makes perfect sense.  Thanks.

> >  {
> >   unshift(@primelist, $_);
> >   @primelist\n";    
> 
> The above line is not a valid Perl statement.
> 

Oh, the "@primelist\n";  ?  I'm not sure how that got
there...

> > 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?
> 
> Define "didn't seem to work"?  On second thought,
> just post that nested 
> foreach and let us help you fix it.
> 
> James
> 

Ok, I went with for loops.  As above, I want to get
the modulus of numbers in one array by comparing the
numbers of another array.  It's not doing what I
expect it to.  I'm not sure if the first loop is
really running either.  What am I doing wrong?  (Does
that question make sense?)

Also, I'm getting an error: Use of uninitialized value
in modulus (%) at primeNumbers.pl line 40, <STDIN>
line 1.
Illegal modulus zero at primeNumbers.pl line 40,
<STDIN> line 1.
What do those errors mean exactly?  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