Not a bad solution, at least for the example I put forth. I like the ability
to have the specific as well as the general in the case statement ('2' and
'__%2 != 0'). Thanks.
> Could a way be found to control the flow so that the next case (not
always
> the one next in the order of the statment) could be executed? For
example
> you have cases 1-10. You want all odd cases to also execute case 9 and
the
> even cases to also execute case 10. So in case 3 you would say
something
> like: pergo(9);
Not necessary.
switch ($val) {
case 3 { print "three"; goto odds }
case 4 { print "three"; goto evens }
odds: case __%2!=0 { print "that's odd" }
evens: case __%2==0 { print "that's even" }
}
Or for those who hate pasta:
sub odds { print "that's odd" }
sub evens { print "that's even" }
switch ($val) {
case 3 { print "three"; odds }
case 4 { print "three"; evens }
case __%2!=0 { odds }
case __%2==0 { evens }
}
Damian