Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: a word of warning about /$pattern/

by Theo (Priest)
on Dec 02, 2003 at 15:42 UTC ( [id://311649]=note: print w/replies, xml ) Need Help??


in reply to a word of warning about /$pattern/

To my limited understanding, it seems like an empty pattern will return true. If all patterns are empty, is the whole expression true? Did you test with all of the patterns being empty?

-Theo-
(so many nodes and so little time ... )

Replies are listed 'Best First'.
Re: Re: a word of warning about /$pattern/
by dada (Chaplain) on Dec 02, 2003 at 16:05 UTC
    To my limited understanding, it seems like an empty pattern will return true.

    that's not true (or not accurate, at least). read carefully the italic lines in my previous message, in particular: if no match has previously succeded, this will (silently) act instead as a genuine empty pattern (which will always match).

    If all patterns are empty, is the whole expression true? Did you test with all of the patterns being empty?

    yes, and yes. and that was even worse, because it helped to hide the bug from my eyes. when all the patterns were empty, all the records did match. but this happened only because no match has previously succeded, so this is something subject to an action-at-a-distance (eg. a succesful pattern match 1000 lines before may very well alter the behaviour of the search).

    cheers,
    Aldo

    King of Laziness, Wizard of Impatience, Lord of Hubris

      (eg. a succesful pattern match 1000 lines before may very well alter the behaviour of the search)

      That's horrible! I'm sure I'll be hit with that one sooner or later. (Hope I remember this fact at that time).

      -theo-
      (so many nodes and so little time ... )

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://311649]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found