MESSAGE
DATE | 2004-11-20 |
FROM | Billy
|
SUBJECT | Re: [hangout] Perl vs. PHP
|
From owner-hangouts-destenys-at-mrbrklyn.com Sat Nov 20 21:18:04 2004 X-UIDL: /dH"!c1U"!4"0"![R?!! Received: from www2.mrbrklyn.com (localhost [127.0.0.1]) by mrbrklyn.com (8.12.11/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id iAL2I4Qc003047 for ; Sat, 20 Nov 2004 21:18:04 -0500 Received: (from mdom-at-localhost) by www2.mrbrklyn.com (8.12.11/8.12.3/Submit) id iAL2I3fe003046 for hangouts-destenys; Sat, 20 Nov 2004 21:18:03 -0500 X-Authentication-Warning: www2.mrbrklyn.com: mdom set sender to owner-hangouts-at-www2.mrbrklyn.com using -f Received: from mail.dadadada.net (MAIL.DADADADA.NET [209.48.2.106]) by mrbrklyn.com (8.12.11/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id iAL2I34G003041 for ; Sat, 20 Nov 2004 21:18:03 -0500 Received: from 24-90-83-25.nyc.rr.com ([24.90.83.25] helo=[192.168.3.102]) by mail.dadadada.net with esmtp (Exim 3.35 #1 (Debian)) id 1CVhLG-0001Qe-00 for ; Sat, 20 Nov 2004 21:20:43 -0500 Message-ID: <419FFAB7.6040508-at-dadadada.net> Date: Sat, 20 Nov 2004 21:17:27 -0500 From: Billy User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: hangout-at-nylxs.com Subject: Re: [hangout] Perl vs. PHP References: <200411192324.13032.sderrick-at-optonline.net> <20041120002945.GA11386-at-www2.mrbrklyn.com> <20041120120315.M12445-at-mrbrklyn.com> <20041120202757.A7940-at-bsd1.nyct.net> <1101003497.30671.0.camel-at-flatbush.mrbrklyn.com> In-Reply-To: <1101003497.30671.0.camel-at-flatbush.mrbrklyn.com> X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-hangouts-at-mrbrklyn.com Precedence: bulk Reply-To: Billy List: New Yorker GNU Linux Scene Admin: To unsubscribe send unsubscribe name-at-domian.com in the body to hangout-request-at-www2.mrbrklyn.com X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on www2.mrbrklyn.com X-Spam-Status: No, score=-2.6 required=4.0 tests=BAYES_00 autolearn=ham version=3.0.0 X-Spam-Level: X-Keywords: X-UID: 39257 Status: RO X-Status: A Content-Length: 1436 Lines: 55
Ruben Safir wrote:
> > >> The immediate context was the (current) lack of a >>case/switch construct in Perl... about which I never understood >>why it is such a big deal. >> >> >> > >The control flow is so flexible in perl that it doesn't need a case >statement. > >Their an idiot. > > I don't think so. I think it should have a case statement.
One of the nice things about Perl is how little you need to write to express the most common sorts of routines. Considering how easy it is to slurp through lines of input files (for example), it's surprisingly hard to write a proper case statement without any bugs, IMHO.
Flexibility isn't always what I want. I want to express my decision tree without jumping through any flaming hula-hoops.
The absence of a switch (or case) statement has always seemed contrary to Perl's (learning-curve reducing) mimicry of C and sh. Which would you rather do?
for($expr){ /^0$/ and do { foostuff; last} /^1$/ and do { barstuff; last} do { defaultstuff; last } }
Or:
switch($expr){ case 0: foostuff; break; case 1: barstuff; break; default: defaultstuff; break; }
I like the second one... fewer keywords, and you're not abusing 'for', 'and', or 'last'. ____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|