Hi,

Offer Kaye wrote on 14.04.2005:

>On 4/14/05, Jan Eden wrote:
>>
>>In example 1, I have to set the variable explicitly 5 times, in
>>example 2, I have to manually list all cases outside the switch
>>statement, which bears the risk of forgetting to modify the line
>>once I extend the switch statement.
>>
>>So is there a better way to do it?
>>
>
>Why not use method #2 and use the @cases array for the actual case
>statements? E.g.: case ($cases[0]) { ...
>}
>
>Note- the parens around $cases[0] are not optional, since this method
>uses a variable as the first argument to "case".

That's a good idea. Thank you!

- Jan
-- 
How many Microsoft engineers does it take to screw in a lightbulb? None. They 
just redefine "dark" as the new standard.

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