MESSAGE
DATE | 2004-11-20 |
FROM | Ruben Safir Secretary NYLXS
|
SUBJECT | Re: [hangout] Perl vs. PHP
|
On Sat, Nov 20, 2004 at 09:20:43PM -0500, Billy wrote: > 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.
/foo/ and do
IS the same thing it matches off of $_ which is defaulted by the for loop
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
|
|