Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Stupid question about strings...

by RichardK (Vicar)
on Jul 14, 2014 at 10:22 UTC ( #1093524=note: print w/ replies, xml ) Need Help??


in reply to Stupid question about strings...

If you don't need any wildcards use index

if (index($str1,$str2) != -1) { ... }


Comment on Re: Stupid question about strings...
Download Code
Replies are listed 'Best First'.
Re^2: Stupid question about strings...
by sundialsvc4 (Abbot) on Jul 14, 2014 at 15:31 UTC

    Best, IMHO, because it is now quite obvious what “the programmer’s intent” must have been.   Anytime I see a regex, I know I’m going to have to “figure out” the regex in order to be certain what the code was meant to do, and I’m going to worry that the bug might actually be caused by some edge-case that the clever programmer didn’t anticipate.   If the same thing can be done with something that is simpler, it’s better.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (15)
As of 2015-08-31 15:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (358 votes), past polls