Argh...I've spent literally an hour trying to get this little bit of code working! Can anyone see why this code won't remove a line of code in folder.pl.
open(FOLDER_LIST,"folder.pl") || &error("Unable to open folder.pl. Reason: $!");
@list = <FOLDER_LIST>;
close(FOLDER_LIST);
foreach $line (@list) {
if ($line ne "$folder\:\:$title") { $put_back .= $line; }
}
print $put_back;
open(FOLDER_BACK,">folder.pl") || &error("Unable to open folder.pl. Reason: $!");
print FOLDER_BACK $put_back;
close(FOLDER_BACK);
$message = "Directory '$title', deleted successfully...";
&show_page($message);
}
The format of the folder.pl file is;
/folder_path/something::title of area
/folder_path/something2::title2 of area
/folder_path/something3::title3 of area
I would imagine its something really obviouse I'm missing...but I can't put my finger on it!
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
sub delete_directory { open(FOLDER_LIST,"folder.pl") || &error("Unable to open folder.pl. Reason: $!");
@list = <FOLDER_LIST>;
close(FOLDER_LIST);
foreach $line (@list) {
if ($line ne "$folder\:\:$title") { $put_back .= $line; }
}
print $put_back;
open(FOLDER_BACK,">folder.pl") || &error("Unable to open folder.pl. Reason: $!");
print FOLDER_BACK $put_back;
close(FOLDER_BACK);
$message = "Directory '$title', deleted successfully...";
&show_page($message);
}
The format of the folder.pl file is;
/folder_path/something::title of area
/folder_path/something2::title2 of area
/folder_path/something3::title3 of area
I would imagine its something really obviouse I'm missing...but I can't put my finger on it!
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!