Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




  • BioScripts
  • Jit
  • Find the number of each 2 consecutive characters AA, AC,AG,AT,CC,CA... with Perl

Find the number of each 2 consecutive characters AA, AC,AG,AT,CC,CA... with Perl

  • Public
By Jit 3114 days ago
#!/usr/bin/perl -w use strict; my $subject = "AACGTACTGACGTACTGGTTGGTACGA"; my %results = (); while ($subject =~ m/[ACTG][ATGC]/g) { # matched text = $& if(exists $results{$&}) { $results{$&}++ } else { $results{$&} = 1; } } foreach (sort keys %results) { print "$_ : $results{$_}\n"; }