> -----Original Message----- > From: Joel [mailto:[EMAIL PROTECTED] > Sent: Thursday, 26 February 2004 7:53 AM > To: perl > Subject: Is there an etc. command in perl? > > Is there an et cetera type command in perl? Specifically,
That's part of the Perl 7 - DWIM spec. You may have to wait until easter though. In the mean time. > while (1) { > my $num = shift @numarray; > if ($num % 2==0) { > > and if the modulus of 2 is 0, find the modulus of 3 and so > on. Can anyone > give me some suggestions? > If I read this correctly, you want to skip the contents of the numarray until you find a number who's modulus 2 is zero, and do something with it. Once you find one, you change the rules and are now looking for a number who's modulus 3 is zero, then 4 etc? my $mymod = 2; for my $num ( @numarray ) { if( $num % $mymod == 0 ) { $mymod ++; <do something here with $num> } } Hope that helps. PS. DWIM stands for 'Do What I Mean'. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>