in reply to foreach problem

Well, your problem seems to come from the fact that foreach file, you print 4 buttons. So you have 4 times as many buttons as you have files - no wonder you get duplicates. Do something like:
print start_from (...); print table (...); s/*[\/\\](.*)/$1/ for @files; while (@files >= 4) { print Tr ({...}, map {td (submit (-name => 'file', -value => $_))} + splice @files => 0, 4); } print Tr ({...}, (map {td (submit (-name => 'file', -value => $_))} @f +iles), map {td ()} 1 .. (4 - @files)) if @files

Abigail