> Hallo everyone and thank you for your previous help
> 
> in basic the code would be
> 
> for x=1 to 100
> Select Case
>     Case=10,20,30,40,50,60,70,80,90
>         then do this
>     else 
>        else do this
> end select
> next x
> 
> how is this done in perl?
> 
> foreach (10,20,30,40,50,60,70,80,90);
> {
> do this;
> }
> 
> ???? I think I need to unpack my books! (i'm moving)LOL
> Lou
> 

Well there is the FAQ about case statements:

perldoc -q 'switch or case'

In your case (pun intended) assuming the list is formed as you have it,
then you could do,

foreach my $index (1 .. 100) {
  unless ($index % 10) {
      # multiple of ten
  }
  else {
      # not a multiple of ten
  }
}

If your matches are not quite so nice,

my @list = (1, 15, 23, 67, 89);
foreach my $index (1 .. 100) {
  if (grep $index == $_, @list) {
     # case matched
  }
  else {
     # non match
  }
}

All code untested, HTH,

http://danconia.org

-- 
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