Just an fyi - you should have a use strict;, a use warnings; and you can use CGI to write your HTML for you. Observe.

#!/usr/bin/perl use strict; use warnings; use CGI ':all'; use CGI::Carp qw(fatalsToBrowser); ######################## our $PATH = "/home/foo/www/dir"; { my @files = sort grep /html$/, glob $PATH; print param() ? selection_report( @files ) : selection_list( @files ); exit; } sub selection_report { return header_template() . center( h3( 'Finished...' ) . "You selected: " . join(", ", param('files') ) ) . footer_template(); } sub header_template { return header() . start_html( -title => 'MY SIMPLE FILE SELECTOR', -bgcolor => '#ffffff', -text => '#000000', -link => '#000000', -vlink => '#000000', -alink => '#000000' ); } sub footer_template { return br() . a( { href => 'javascript:history.back()' }, 'Go Back...' ) . small( small( '...' ) ) . end_html(); } sub selection_list { my @files = @_; return header_template() . center( h2( 'MY SIMPLE FILE SELECTOR' ) . br() . br() . small( b( "The following [$#files] files were foun +d in the [$PATH] directory." ) ) ) . br() . br() . table( div( { -align => 'center' }, center( table( { -width => 246 }, Tr( td( { -align => 'left', -width => 312 }, start_form( -method => 'P +OST' ) . li( { -type => 'square' + }, font( { -size => 2 +}, i( 'Select fi +les' ) ) . br() . map( b( checkbox_ +group( 'files', + $_ ) ), @files) ) . p( submit( -name => 'cr +eate_list', -value => 'C +reate' ) ) . end_form() ) # </td> ) # </tr> ) # </table> ) # </center> ) # </div> ) # </table> . footer_template(); }

In reply to Re: a question about working with the forms and array by diotalevi
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.