There's a lot to tackle here. First, and most important, is that you don't tell us what, precisely, isn't working. That would potentially help to narrow it down, because there are a lot of problem areas.

The latter two are really serious problems: you have no way of reading the results of your user's interaction.

Some larger issues that pertain to performance and readability: foreach (@thefiles) and foreach $_ (@thefiles) are functionally equivalent, but the longer version has the added bonus of not being idiomatic and also potentially confusing. You don't need to loop through an array to get its size, and you definitely don't need to sort that array and throw away the results while doing so. $count = @thefiles will get you the answer you seek there.

Most importantly, you're not using strict in this code, which gives you the false convenience of globals; this makes it harder to understand your program, especially for someone who didn't write it. This has a further deleterious effect on your subroutines, which don't group the various functional bits of your program together in a natural way. Think about the smallest pieces of stuff your program needs to do and work from there. I would suggest that you have one subroutine that gets the list of files, sorts it, and returns it, and another to generate the checkbox form, and takes as a parameter the list of files. That should be enough to get you started.

HTH!

If not P, what? Q maybe?
"Sidney Morgenbesser"


In reply to Re: a question about working with the forms and array by arturo
in thread a question about working with the forms and array by Anonymous Monk

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.