MESSAGE
DATE | 2004-11-20 |
FROM | Billy
|
SUBJECT | Re: [hangout] Perl vs. PHP
|
Ruben Safir wrote:
>>That's my least favorite Perl feature. They give you this as a >>consolation prize: >> >>for($var){ >> /foo/ and do { stuff; last }; >> /bar/ and do { barstuff; last }; >> /bat/ and do { batstuff; last }; >> /baz/ and do { bazstuff; last }; >>do { defaultstuff; last }; >>} >> > >No > >sub1 if ($var =~ blah ); >sub2 if ($var =~ blah2); >sub3 if (var =~ blah2); > > >And there is a zillion other ways. > >Even hook up a sub ref to a hash. > that is NOT THE SAME THING! if $var matches blah and blah2, you're going to execute sub1, sub2, and sub3. In a switch statement, you only want ONE of these to happen.
____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|