There's a few ways of doing this. Here's one:
$ perl -Mstrict -Mwarnings -E ' my $x = q{ac-t-c-t-g}; $x =~ /[acgt]/g for (1..4); say substr($x, 0, pos($x)); ' ac-t-c $ perl -Mstrict -Mwarnings -E ' my $x = q{a----c-tg-ggg}; $x =~ /[acgt]/g for (1..4); say substr($x, 0, pos($x)); ' a----c-tg
-- Ken
In reply to Re: Perl match
by kcott
in thread Perl match
by nicholaspr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |