Hi Monks!
I have some code (listed below) within a module that does behave as it should but leads to error messages:
Use of uninitialized value in subtraction (-) at /usr/lib/perl5/site_perl/5.8.5/Chemistry/File/AMBERprmtop.pm line 109, <GEN0> line 1044. at /usr/lib/perl5/site_perl/5.8.5/Chemistry/File/AMBERprmtop.pm line 109
I cannot see what value is not initialized: $n and $r are initialized in line 104, $respt[$r] is part of @respt which is initialized in line 80.
Am I missing something? (Sure, I do...) Any hints are welcome! Thanks for your help.
80: my ($lines, @masses, @names, @charges, @resnames, @respt, $symbo
+l);
99: for ($lines=$pointers{respt}[0]; $lines<=$pointers{respt}[1]; $l
+ines ++) {
100: push @respt, (unpack (("A8" x (length($file[$lines]) / 8)), $f
+ile[$lines]));
101: }
104: my ($n, $r) = (0, 0);
105: for $n (0 .. $#masses) {
109: if ($n == ($respt[$r]-1)) {
110: $r++;
111: }
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.