No. It is because you are being silly. Some important lines of code are:

my @new = split ('>', $joi1); ... my @new; .. foreach (@new) {

Which of the two @new variables do you expect will be used by the for loop?

Why didn't you show us the '"my" variable @new masks earlier declaration in same scope at ...' errors you received or the errors about @alp and @num? Have you actually run the code you've shown us?

It helps us a lot to help you if you give use sample code we can actually run and if you show us the result you get and the result you would like from running the code. Oh, and the sample code and results should be short. For example cleaning up your code a little including fixing all stricture warnings and errors:

use warnings; use strict; my $seq = <<DATA; >s1 AGCTTTTCGGGCAAT >s2 GCTGCCCCCCATCTT >s3 TCGTAGCTGAAAATC DATA my $num = <<DATA; >s1 23 43 45 65 76 54 3 34 54 65 7 45 56 87 56 >s2 23 43 23 45 65 45 76 78 34 8 12 32 65 23 25 >s3 12 23 34 45 56 54 43 32 65 43 12 34 75 76 45 DATA open FH1, '<', \$seq; open FH2, '<', \$num; my @arr1 = <FH1>; my @arr2 = <FH2>; my $joi1 = join (' ', @arr1); my $joi2 = join (' ', @arr2); my @new = grep length, split ('>', $joi1); my @numbers = grep length, split ('>', $joi2); my @seqid; my @alp; foreach (@new) { my ($seq_id, $seq) = split (/\n/, $_); push (@alp, grep /[ACGT]/, split ('', $seq)); push (@seqid, $seq_id); } my @num; my @numid; foreach (@numbers) { my ($num_id, $numb) = split (/\n/, $_); push (@num, split (' ', $numb)); push ( @numid, $num_id ); } my @keep = grep {$_ < 1 || $num[$_] >= 10 || $alp[$_ - 1] ne $alp[$_ - 0]} 0 +.. $#num; print (join (' ', @alp[@keep]), "\n"); print (join (' ', map {sprintf '%2d', $_} @num[@keep]), "\n");

prints:

A G C T T T C G G C A A T G C T G C C C C C A T + C T T T C G T A G C T G A A A A T C 23 43 45 65 76 54 34 54 65 45 56 87 56 23 43 23 45 65 45 76 78 34 12 3 +2 65 23 25 12 23 34 45 56 54 43 32 65 43 12 34 75 76 45

Perl reduces RSI - it saves typing

In reply to Re^3: deleting a particular character and its coresponding score in 2 different files!!! by GrandFather
in thread deleting a particular character and its coresponding score in 2 different files!!! by heidi

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.