Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
"be consistent"
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Don't use this sort of construct:

if ($pdbline =~ /OD2 ASP/ or /NE2 HIS/)

You are testing 2 possibilities here. The first one is $pdbline =~ /OD2 ASP/ which may be fine, but the second one is /NE2 HIS/ which by default will test $_ which is probably not what you want. Either combine the 2 regular expressions into 1 (left as an exercise) or test them individually like this:

if ($pdbline =~ /OD2 ASP/ or $pdbline =~ /NE2 HIS/)

The "Use of uninitialized value" reports you see are warnings, not errors. However, the fact that they are presented to you indicates that you are attempting to do something with an uninitialised value which is usually not what you intend.

In this specific case, your references to items like $x1[$Znx] on line 58 will give that if the $Znx is uninitialised. You will need to trace through the logic to see how that might happen and correct it.

Best advice is:

  • use strict; # Always
  • Lose the prototypes unless you have a very, very good reason for keeping them.
  • Don't use "or" like you were.

Best of luck with the rest of it.


In reply to Re: calculate distance between atoms and a target atom by hippo
in thread calculate distance between atoms and a target atom by mishimakaz

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2014-04-17 07:11 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (440 votes), past polls