Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The "extreme" (no pun or reference intended!) example of this would be writing "one-liners" -- running perl -[np] -e ... from your command line. I use that for massaging data files and for extracting simple statistics. Sure, I could modularise the statistics and write it just once, but looking up the exact interface for a counter-that-also-keeps-average-value will take longer than recoding it. Maintainability isn't an issue here: if you're asking a question about a log file in order to find out if it's an interesting question at all, you're most likely going to decide you don't care about the answer.

Similarly, we sometimes run programs for days on end, only to discover a small bug in output. We'll fix the bugs, no question, but we don't want to lose the CPU time. If a small script can fix the output, we want it! (However, as tilly points out above, you can only do this if you've a backup; perl -pi.bk -e ... is invaluable here). The "patch" code will never run again, as the bugs in the program have been fixed -- it only exists to correct a single output file!

This is bioinformatics: some of our files are >1GB in size, so text editors are not an option; it's either sed, awk or Perl.

In both cases, you want to write code iteratively (the first 5 versions never work), run it once, and throw it away.

Of course, I always hide away a copy of the script in my home directory; I never know when I'll want to steal some stuff from an old script.


In reply to Re: Reactionary Coding?One-Shot Programs by ariels
in thread Reactionary Coding—One-Shot Programs by John M. Dlugosz

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 admiring the Monastery: (3)
As of 2024-04-19 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found