Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: string match using with an N in any position

by salva (Canon)
on Nov 18, 2011 at 07:34 UTC ( [id://938748]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %match = map { $_ => 1 } qw(GCGAT CACGT);
    
    ...
        s/N//; # remove the first N in the string
        print "match: $line" if $match{substr($_, 0, 5)}
    }
    
  2. or download this
    my $pattern = join('|', qw(GCGAT CACGT));
    $pattern = qr/^(?:$pattern)/;
    ...
        s/N//; # remove the first N in the string
        print "match: $line" if $_ =~ $pattern;
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-28 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found