From: Morton Goldberg Date: 2007-05-09T06:34:14+09:00 Subject: Re: Difference answers from Terminal, TextMate, and BBEdit On May 8, 2007, at 12:52 PM, Brian Candler wrote: > Ugh, you're right. It doesn't even compare against $_. > That seems rather pointless, as it's just the same as if .. > elsif .. end AFAIK, a case statement without a target can always be rewritten as a if-elsif-else statement, but I don't think that makes a target-less case pointless. When there are many conditions to be handled, I find the target-less case more readable. A matter of taste, I suppose. OTOH, the point I wanted to make with the OP was, in his case, with only two conditions to be handled, an if-elsif-else statement would be more readable and the better way to go. > And what about > > case > when (1..100) > # whatever > end > > That would be the flipflop operator borrowed from Perl? But with > both ends > true as well? I think it would work exactly the same as if (1..100) # whatever end But I haven't tried it. And probably never will -- the flip-flop behavior of ranges in a boolean expression is something I avoid as a little too tricky. Regards, Morton