http://qs1969.pair.com?node_id=297991


in reply to a question about working with the forms and array

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"