This response directs itself to your second question.
Your code passes a syntax check... that is to say, my Perl (5.016) detects no syntax errors.
However, your code suffers from several shortcomings:
- The "-w" and "use warnings:" are effectively duplicative, in this particular code (ie, where you are not using an external package or module and, thus, where -w's additional effect does NOT propagate to that other code).
- You are not checking the outcome of your open(...)s. That's a practice that's almost certain to bite you (and, "HARD!").
- Instead, you should include a or die "Can't open... $!;" clause that will alert you if your open fails for some reason.
- Better yet, use three-argument opens: adopt the above, the use of "<" for read or ">" for writes (BTW, there are other options) and use of a lexical filehandle
execute perldoc -f open from your OS' command line for details and examples
- Your "close" commands seems to have fallen out of your code. This, too, can BITE!
Turning to your post, itself:
I know -- off the top of my head -- of at least three diffent ways that the file extension ".pdb" is used -- Palm dbs, C++ debugging, and "Protein Data Bank" data. You really should specify as it's unreasonable to expect the Monks will be able, magicly, to infer which you mean.
And, returning to your second question ("(i)s THIS code is correct...." (sic)) that's easy enough to determine pragmatically: Try it to see. Somehow, I suspect that's not your real question, but, again, you can't expect magic inferences about your actual intent.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|