I wanted to know if I need to save the flat file as a txt or html document. Would I then put that into a cgi-bin or not. Also, I have tried saving this as a CGI program but does not seem to work. I have also tried saving it as a PL document. Any help would be great.

#!/usr/local/bin/perl my $in; if ($ENV{'REQUEST_METHOD'} eq "GET") { $in = $ENV{'QUERY_STRING'}; } else { $in = <STDIN>; } $in =~ s/\+/ /g; $in =~ s/%(..)/pack("c",hex($1))/ge; my %movie = split (/=/, $in); open (DATA, "/home/export/users/cis14/cheu0576631/public_html/cgi-bin/ +MovieList.txt"); my @data = <DATA>; close (DATA); print <<END; Content-Type: text/html\n\n <html> <body bgcolor="#000000" text="#ffffff"> <center><h2>Results</h2></center><p> <center><hr size=1 width=50%></center> END for ($i = 0; $i <= $#data; $i++) { if ($data[$i] =~ /-- $movie{'title'} --/i) { print <<END; <center><b><font size="+1">$data[$i + 1]</font></b></center><br> $data[$i + 2]<br> END last; } elsif ($i == $#data) { print "<b><i>Sorry! I haven't reviewed that one yet!</i></b>"; } } print <<END; <center><hr size=1 width=50%></center> </body> </html> END

In reply to Flat-File 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.