#!/usr/bin/perl use strict; use warnings; my $ctfile = "M23263_rna_300-1.dat_1.ct"; my $matchfile = "match_super.dat"; my @match;my %hash;my $fragment; my $position; open (A, "<", $matchfile) or die "Check the file $!\n"; while (my $line = ) { chomp $line; (my $mat, $fragment, my $score, $position) = split(/\t/, $line); $hash{$fragment} = $position; } foreach my $key(keys %hash) { # print "$key\t$hash{$key}\n"; my @temp = split ("", $key); foreach my $val(@temp) { print "$val\t$hash{$key}\n"; } } close (A); my ($num1, $base, $num2, $num3, $connect, $num4); open (B, "<", $ctfile) or die "Check the file $!\n"; while (my $ctline = ) { chomp $ctline; if ($ctline =~ /^(\d+\s+dG.*)/) { # print "$1\n"; next; next; } my @tempfile = split (/\s+/, $ctline); my $base = $tempfile[1]; my $connect = $tempfile[4]; print "$base\t$connect\n"; } close (B);