note
ajt
<p>[chriso]</p>
<p>You don't show the whole code, but on the face of it what you show isn't going to work, and worse still it may be very dangerous.</p>
<p>I hope you have properly de-tainted and verified that the value of <code>$course_no</code> is nice and safe, otherwise all sorts of undesirable things may happen!!!</p>
<p>Once you are happy that things are safe, then the following may work better with your concatination:</p>
<code>
my $file = "/usr/local/apache2/htdocs/crs_desc/" . $course_no . "desc.txt";
open DESCDOC, "<", $file || die "Unable to open $file";
</code>
<p>Your concatination is a bit messy, which I clearly spelt out, so it should be okay now. Other solutions would work too. I've change your fatal to report which file it couldn't open, in case the name isn't what you expected - your error handling won't take care of that unless you pass the filename to it.</p>
<p>Others will have more advice, but also see (from an earlier node of mine):</p>
<ul>
<li>[id://252726]</li>
<li>[id://253089]</li>
<li>[Ovid]'s CGI Course: <a href="http://users.easystreet.com/ovid/cgi_course/lesson_three/lesson_three.html">CGI Security</a></li>
<li>[davorg]'s CGI Notes: <a href="http://www.mag-sol.com/Articles/cgi2.html">CGI Security</a></li>
<li>Perl Training Australia: <a href="http://perltraining.com.au/notes/perlcgi.pdf">Perl CGI</a> (PDF) Chapter six</li>
</ul>
<br/>--<br />
<a href="http://use.perl.org/~ajt/journal/">ajt</a>
255678
255678