#!/usr/bin/perl use strict; use warnings; print "Select the region where you want to find CpG Island\n"; my ($a,$t,$c,$g,$cg,$total); print "1. Region 1-200\n"; print "2. Region 2-202\n"; print "3. Region 3-203\n"; my $choice =; chomp($choice); my $file = 'd:\perl\1.txt'; if ( $choice == 1 ) { region(0); } elsif ( $choice == 2 ) { region(1); } elsif ( $choice == 3) { region(2); } sub region { my $start = shift; open(INPUT, $file) or die ("File not found"); foreach(my $line = ) { my $a = substr($line,$start,200) =~ tr/A//; my $t = substr($line,$start,200) =~ tr/T//; my $g = substr($line,$start,200) =~ tr/G//; my $c = substr($line,$start,200) =~ tr/C//; my $cg = substr($line,$start,200) =~ tr/ CG //; my $total = substr($line,$start,200) =~ tr/ATGC//; } } my $CpG = ($cg)/$total*100; print"Count of A = $a\n"; print"Count of T = $t\n"; print"Count of G = $g\n"; print"Count of C = $c\n"; print"CG = $cg\n"; print"total count of ATGC = $total\n"; print"CpG percentage = $CpG\n"; if ($CpG>=60) { print"CpG present"; } else { print"CpG absent"; }