in reply to Unlink doesn't work on first file
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:
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.foreach (@view_list){ if ($first){ print "<option value=\"$_\"> $_ \n"; } else{ print "<option value=\"$_\" selected> $_ \n"; $first=1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Unlink doesn't work on first file
by runrig (Abbot) on Nov 14, 2002 at 19:47 UTC |