MESSAGE
DATE | 2004-11-20 |
FROM | Ruben Safir Secretary NYLXS
|
SUBJECT | Re: [hangout] Perl vs. PHP
|
> The C switch will evaluate the expression (once), > and jump to a case that matches the expr.
Unless you have one of those new fangle nueral net hardware systems, I believe that it has to evaluate each match one at a time.
If it doesn't I'm very curious on how it can jump to any of the arbitrary conditions without testing for them.
> The case > usually ends in a break, but it doesn't have to.
If it doesn't have a break it should go on to the next condition and run it if it matched (of maybe I'm wrong and jumps to the default). But I think I'm right.
> lovely features like the phone system crash > of 1991-01-15.
:) like I said, cases are bug cities.
> > What's the Perl alternative to that behavior? > You haven't offered one. 'last' is Perl's 'break'.
SWITCH: { if /blah/{ &blah; last SWITCH; } if /blahi1/{ &blah1; last SWITCH; } if /blah2/{ &blah2; last SWITCH; } if /blah3/{ &blah; last SWITCH; } print STDERR "\nYo - this aint supposed to happen!"; exit; }
There is problibly a short syntax with commas
Ruben -- __________________________ Brooklyn Linux Solutions
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://fairuse.nylxs.com
http://www.mrbrklyn.com - Consulting http://www.inns.net <-- Happy Clients http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....
____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|