Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: string match using with an N in any position

by JavaFan (Canon)
on Nov 18, 2011 at 10:04 UTC ( #938768=note: print w/ replies, xml ) Need Help??


in reply to string match using with an N in any position

Just be pragmatic:

my $str = "GCGAT"; my @PATS = map { my $s = $str; substr $s, $_, 1, "N"; $s; } 0 .. length($str) - 1; push @PATS, $str; foreach my $str (@PATS) { if (index $value, $str) == 0) { print "Oh, joy, it's a match"; } }
There's no reason to be clever. But do note the above code is untested.


Comment on Re: string match using with an N in any position
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-09-21 10:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls