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

Re: calculate distance between atoms and a target atom

by hippo (Abbot)
on Dec 02, 2013 at 22:15 UTC ( #1065330=note: print w/replies, xml ) Need Help??

in reply to calculate distance between atoms and a target atom

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1065330]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-09-23 13:51 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (272 votes). Check out past polls.