in reply to Request to correct the perl code for getting substrings
(this assigns the scalar value "CCATG..." to $d[0]) just to flatten it later like so:@d = “CCATGNNNTAACCNNATGNNTAGCC”;
There are a couple of other things in your code which are unclear to me. That said, the essential bits might be done this way:my $string ="@d";
Notes:#!/usr/bin/perl -w my $string = "CCATGNNNTAACCNNATGNNTAGCC"; while($string =~ /[AG]TG.*?[AG][AG]/g) { print "matched at ", pos($string) - length($&), ": ", $&, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Request to correct the perl code for getting substrings
by jwkrahn (Abbot) on Apr 19, 2012 at 22:17 UTC | |
by oldtomas (Novice) on Apr 20, 2012 at 06:57 UTC |