[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] A tiny bit of fun with a regex



On Thu, Aug 12, 1999 at 02:08:50PM -0700, lr@hpl.hp.com wrote:
> > From: Brand Hilton [mailto:bhilton@adc.com]
> > Sent: Thursday, August 12, 1999 13:46
> > To: fwp@technofile.org
> > Subject: [FWP] A tiny bit of fun with a regex
> >
> >
> > Okay, so this doesn't exactly require a PhD to find, but I did find it
> > mildly amusing.  If you want it to be at all challenging, you can't
> > run it with -w or use strict.
> >
> >   $_ = 'The score was 2/0 in the second inning.';
> >   print "found it\n" if /\d+
> >                          \/
> >                          \d+  # find something of the pattern y/x
> >                         /x
> 
> Without -w or use strict, I see a division of 1 by the value of the
> bareword 'x', which is undoubtedly 0, so a run-time exception.
> 
> What do I win?

Well, it was kind of an easy one, so how about a wink, a nod, and a
thumbs up?

I ran across it when I had the phrase "and/or" in a regex comment. 
I thought maybe I could hide it a little bit and make it more
challenging to find.  Apparently not :-)


        Brand

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe