Last active
December 17, 2015 09:39
-
-
Save keedi/5589200 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
print "Enter your DNA sequence: "; | |
my $input = <STDIN>; | |
chomp $input; | |
my @groups = $input =~ m/(.{1,3})/g; | |
say "count of groups: ", scalar(@groups); | |
my $count = 0; | |
for my $group (@groups) { | |
++$count; | |
say "group[$count]: $group"; | |
} | |
__DATA__ | |
How to Run? | |
$ perl dna-sequence-count.pl | |
Enter your DNA sequence: ATGCATGCATGCATGCATGC | |
count of groups: 7 | |
group[1]: ATG | |
group[2]: CAT | |
group[3]: GCA | |
group[4]: TGC | |
group[5]: ATG | |
group[6]: CAT | |
group[7]: GC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment