5. Extract a sequence MKKTGIKG from ASMKATAHQMKKTGIKGMSTYALLRL and print it out in a file MJ
Idea
Using 's (searching)' function, I search 'MKKTGIKG' sequence and replace to ' ' for extracting this sequence.
Code
#!/usr/bin/perl
use strict;
use warnings;
my $origin_string = 'ASMKATAHQMKKTGIKGMSTYALLRL';
my $string = 'ASMKATAHQMKKTGIKGMSTYALLRL';
print "The original sequence is '", $origin_string, "'\n";
$string =~ s/MKKTGIKG//ig;
print "Result of extracting MKKTGIKG : ", $string, "\n";
exit;
Result
[[1]]