Hey everyone. Thanks for your insight.
The problem actually wasn't with unlink, but rather it was in the way the program stored the filenames in an array. The program globbed the directory, removed all *.CGI files from the array, and then displayed them in a select box.
Here's the code that displayed the select box:
foreach (@view_list){
if ($first){
print "<option value=\"$_\"> $_ \n";
}
else{
print "<option value=\"$_\" selected> $_ \n";
$first=1;
}
In that else statement, there was an extra space after the $_ in value, causing the first file in the directory to be stored with an extra space on the end. The program then switched all spaces to %20. The actual filename never had a space so it would never match when unlink was called.
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.