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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The original example uses:
open(DBA, "+< $datafile") ...
but the next 2 code examples use:
open(TMPA, "+> $tempfile") ...
Note the direction of the mode indicator - in the first example, you are opening the file for read/write access, or, to be specific, you are opening the file for input, and want read/write access. In the next examples, you are opening it for output (and clobbering the contents in the process), and want read/write access. The second is not very useful: if you have already opened it for writing, and just set it to zero length, there is nothing to read! If you are using flock, you want to use the first example, so that any changes made to the file (like, say, truncating it to 0 bytes) is made *after* you have sucessfully flocked the file. You could possibly use the second in cases where you do not care about what is in the file, but merely about whether it is locked or not (e.g. a semaphore).


In reply to RE: More Eyes, Please by turnstep
in thread More Eyes, Please by Kozz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-20 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found