SPUG: A dereferencing paradox?

Daniel Chetlin daniel at chetlin.com
Fri Sep 29 01:50:23 CDT 2000


On Thu, Sep 28, 2000 at 10:25:29PM -0700, Jeremy Devenport wrote:
> 1. The regular expression /$_{cuisine}/i actually gets compiled as //.
>    That's a regular expression that matches everything. This happens
>    because "$_{cuisine}" is an empty string, why? Because %_ does not
>    have a value matching the key "cuisine". I verified this using "use
>    re 'debug'" under perl 5.6.0.

Worse -- any REx that evaluates to the empty string defaults to the last
successful match. So, in cases where you haven't had a previous
successful match, it will always match, but if there has been a previous
successful match it may very well _not_ match.

> But the take-away from this email is "use re 'debug'" rules, does this
> (or an equivilant) exist on earlier versions than 5.6.0?

Yes, it was around for 5.005. Not for 5.004, though.

-dlc

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list