Scott@Charter wrote: > Can anyone please help me with a short example Perl script that will print > out all the odd numbers between 1 and 10? I don't know Perl and am trying > to learn it. I wrote a bash script to do the same thing and wanted to > compare it. > > There must be a Perl expert out there somewhere who can help me? > > Thanks- > Scott foreach ( 1 .. 10 ) { print "$_ " if ($_ % 2 == 1); } ".." is an operator that will return a list that is the range between left and right. foreach will run the code block for each item of the list, setting $_ to that item. print ... if does like it sounds, and % is the modulo operator, in other words, it returns the remainder if the % had been a /. I hope this helps you, and I apologize for the unkind responses you have received from the list here. If you have any perl questions, you may try http://www.perlmonks.org -- Matt Howard <mhoward@xxxxxxxxxx> Superior Insurance - Technical Services - : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html