Overall nice. There are a handful of idioms that would save typing though.

First, when you're iterating through a list, you don't have to keep an index around:

my @items = (1, 2, 3, 4, 5); foreach my $item (@items) { print "Got item $item!\n"; }
Next, you don't need to stringify a variable if you want to bind it to a regex.

Third, there's a lot of duplication. From my skimming of the code, it's in your conditionals. There are plenty of ways to handle this, from stringing conditionals together to calling a subroutine. I'd do it all in just one regex, though:

if ($item =~ /^(foo|bar|baz)/) { # do several things }
You can probably get rid of the '+' in your opens. It's pretty rare that you need both read and write access. The rest of it is pretty solid, though you might want to be careful calling subs with a leading ampersand... it'll pass along the contents of @_. I prefer sub() to pass no arguments explicitly.

Update: Renamed to fit new title.


In reply to Re: Document maintenance script by chromatic
in thread Document maintenance script by blacksmith

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.