On the face of it, your problem is easily solved with Perl. You just need a little help with the jargon.

use strict; use warnings;

...would show you that $m51 is not defined on line 39. This is probably a typo -- please use real code :D.

It is not clear what the script should be doing, other than rewriting all the ATOM lines, without field 4.

This snippet (reformatted for "standard" readability):

foreach $line (@m3,@m5){ if ($m3[$line] eq $m3[$line+1]) { $m5[i]=$m5[i+1]; } elsif ($m3[$line] ne $m3[$line+1]) { $m5[i+1]=$m5[i]+1; } }
...tries to index @m3 by using one of its values. According to your regex, $m3 is \w{3}, so it will probably evaluate to index 0. Also, using "i" as an index should not compile.

Please show us your sample script, and a sample input and output (what you got, and what you really want). We can then walk you through this.

-QM
--
Quantum Mechanics: The dreams stuff is made of


In reply to Re: Rearrange the residue number of a pdb file according to the residues names by QM
in thread Rearrange the residue number of a pdb file according to the residues names by nastaziales

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.