Update: At first I considered your tr// statement to mean that you would be doing full security checking, but it has (rightly) been pointed out that there are huge security concerns here that it would be wrong to ignore. Read
KM's reply below
1) In this line:
if (!(open (OUT, ">$_"))) { print "Error opening file $_
for writing."; exit 0; }
Try this:
if(!open(OUT, ">$_")){
print "Error opening file $_ for writing: $!";
# $! holds the error mesg
exit 0;
}
The more tradional way to write this is:
open(OUT, ">$_") or die "Can't open $_ for writing: $!";
Since you are using this in a CGI program, it'd be a good idea to use
perlfunc:warn or
perlfunc:die too. (See the module CGI::Carp for http friendly die and warn functions)
But it doesn't seem to get to this point, so this isn't the source of the troubles.
2) some more information would be useful. You have the line:
print ">$_";
Does it get printed? (Note that print statements might occur but not get printed if they are in the buffer when the program gets confused. Either use warn statements, or set $|=1, which will autoflush any statements in the buffer).
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.