I'd run it through perltidy (on SourceForge, I believe) first, so the structure is workable. You might also use B::Deparse, to get it it something resembling actual code. Then read it. All of it. Print it out and mark it up, if necessary. 4000 lines translates to ~60 pages, at 8 point font. That's not too awful.
Having read it, you might have noticed duplications or near duplications. There's your chance to factor out common code into subroutines. This also allows you better encapsulation -- you can use lexicals instead of globals, passing in and receiving data. The program will get shorter and shorter, as you do this.
Based on my experiences reworking File::Find (soon, soon), you may be able to cut out 25% or more of the code.
(Extra free advice: wouldn't it be nice if this old code had unit tests, so you could change things and verify it still performed as expected? Someday, your code will be maintained. Make life easier for someone else.)
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.