Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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 imbibing at the Monastery: (2)
As of 2017-11-25 10:23 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (355 votes). Check out past polls.