First off I'd restructure that somewhat to separate the business logic from generating the HTML. That makes it possible to see the actual code. Along the way I'd switch to using a lexical file handle.

But most importantly I'd trap runtime error and report any error returned by open if it fails. Putting that all together along with modern strictures you get:

use warnings; use strict; use CGI; my $result; eval { my @query = split(/=/, $ENV{'QUERY_STRING'}); my $term = $query[$#query]; my $file = 'd:\\apps\\AETrigger\\' . $term . '.txt'; $result = open (my $fh, '>', $file) ? "Trigger for $term ($query[0]) has been created." : "Error '$!' creating trigger; please contact support."; return 1; } or do { $result = "Error: $@"; }; print <<HTML; Content-type: text/html <html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; ch +arset=iso-8859-1" /> <link rel="stylesheet" href="http://pctldocs/doc_style.css" type="text +/css" /> <title>Trigger Result</title>\n</head> <body> Result:<br /> $result </body>\n</html> HTML

If that doesn't get you a page reporting the error then more likely you have a configuration error somewhere. Have you tried a simple "Hello World" program?

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

In reply to Re: Resource Not Found error by GrandFather
in thread Resource Not Found error by StorminN61

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.