Hi Charles, My system have perl 5.001, and somehow when i run your code i get error.
webhome: 19% write.cgi Global symbol "name" requires explicit package name at write.cgi line +10. Global symbol "name" requires explicit package name at write.cgi line +11. No comma allowed after filehandle at write.cgi line 28.
Here are the code i used:
#!/usr/bin/perl -T use strict; # use warnings; # use diagnostics; use CGI qw/:standard center/; opendir DIR, "./Data" or die "Couldn't open directory ./Data: + $!"; my @files; while ( my $name = readdir DIR ) { next if $name !~ /^\d*.html/; push(@files, $name); } closedir DIR or die "Couldn't close directory './Data': $!"; my $next_file = 'testing.html'; open OUT, ">Data/$next_file" or die "Cannot open 'Data/$next_ +file': $!"; print OUT start_html( -title => param('title'), -bgcolor => '#FFFFFF'), center( h1( param('heading') ) ), br, p( param('body') ), end_html; close OUT or die "Cannot close 'Data/$next_file': $!"; push @files, $next_file; print header, start_html( -title => 'File Listing'); print a({ -href => "Data/$_" }, $_ ), br for @files; print end_html; exit;

In reply to Re: Re: New and need help in cgi, perl by britney
in thread New and need help in cgi, perl by britney

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.