hi friend, Try out this one :)
open(FILE1,"file1.txt") or die $!;@file1=<FILE1>;close(FILE1); open(FILE2,"file2.txt") or die $!;@file2=<FILE2>;close(FILE2); foreach $file2(@file2){ if($file2=~/(\w+)(_)(\w+)\s(\w+)(=)(\d+)/) { $id=$1; if($3 eq 'right'){$value=$6."r#";} if($3 eq 'left'){$value=$6."l";} push(@array,"$value"); push(@id,"$id"); } } push(@newid,grep {!$ss{$_}++} @id); @arraysplit=@array2=$ss=(); $ss=join('',@array); @arraysplit=split(/\s+|\n/,$ss); @array2=split('#',$arraysplit[0]); foreach $f1(0 .. $file1[$#fiel1]) { if($file1[$f1] =~/>/){ $firstline=$file1[$f1]; chomp($firstli +ne); } if($file1[$f1] =~/^>/) { $secondline=$file1[$f1+1]; $secondlinej=join('',split(/\n/,$secondline)); foreach $vv(0 .. scalar @array2) { if($newid[$vv] eq substr($firstline,1,6)) { ($left,$right)=split(/r|l/,$array2[$vv +]); print "\n".substr($firstline,0,7)."_le +ft"." length=$left \n"; @secondlinejj=split('\s',$secondlinej) +; for ($l=0;$l < $left;$l++){print "$sec +ondlinejj[$l] ";} print "\n"; print "\n".substr($firstline,0,7)."_ri +ght"." length=$right \n"; $len=scalar @secondlinejj."\n"; $right=$len-$right; for ($m=$right;$m <= scalar @secondlin +ejj;$m++){print "$secondlinejj[$m] ";}print "\n" } } } }
Output will be like this
>AAAT3R_left length=6 40 40 40 40 40 40 >AAAT3R_right length=62 40 40 40 40 40 38 38 37 39 36 36 40 36 35 35 35 38 40 35 35 33 35 35 3 +5 40 40 40 40 37 37 38 38 38 40 40 40 40 40 40 40 40 40 40 40 40 40 4 +0 40 40 37 36 36 31 22 22 22 20 20 20 20 20 14 >AAA2OJ_left length=14 18 18 18 21 35 35 35 32 32 32 33 35 38 39 >AAA2OJ_right length=14 37 37 37 37 3737 33 32 32 30 20 17 17 17 0

In reply to Re: sorting and other problems in hash by sanku
in thread sorting and other problems in hash by sugar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.