I am asking a seemingly simple question, and hoping for a quick response.
I have a text file of message board posts. It's made up of arrays, and looks something like this.
user1|pass1|post1|email1|\user2|pass2|post2|email2|\user3|pass3|post3|email3|\ and so on
So I first split up the arrays using the \ delimeter, and secondly break each of those down to post.
I need to know how to delete one of those items (in the big array, the ones that are seperated by \'s). I can delete the first item using shift, but I may need to remove the second or third. I am trying to do something where an admin can come in, delete one of the posts and it will leave no mark. The deleting script would have the array id
($variable[id]) and would have to be able to remove a full item (including the \) from the text file, and then rewrite the text file with the remaining items of the array. Sounds like a mouthfull, but I know it can be done.
The end text file would then contain something like this (if the second big item was taken out)
user1|pass1|post1|email1|\user3|pass3|post3|email3|\
Here's the access code, should it help
if (-e "../nar/followups/$id.txt") { #if the logfile exists
open (LOGTF, "../nar/followups/$id.txt") || &ErrorMessage;
$typistf = <LOGTF>; #variable assignment
close (LOGTF);
@typistd = split(/\\/, $typistf); #split the BIG arrays
foreach $type (@typistd) { #the foreach loop
@follow = split(/\|/, $type); #split each smaller array
if ($follow[4] eq "") { #if there is no post image
$follow[4] = "general.gif"; #assign this one
}
if ($typist[4] eq "News") { #distinguish between news and rumor
Thanks
I have a text file of message board posts. It's made up of arrays, and looks something like this.
user1|pass1|post1|email1|\user2|pass2|post2|email2|\user3|pass3|post3|email3|\ and so on
So I first split up the arrays using the \ delimeter, and secondly break each of those down to post.
I need to know how to delete one of those items (in the big array, the ones that are seperated by \'s). I can delete the first item using shift, but I may need to remove the second or third. I am trying to do something where an admin can come in, delete one of the posts and it will leave no mark. The deleting script would have the array id
($variable[id]) and would have to be able to remove a full item (including the \) from the text file, and then rewrite the text file with the remaining items of the array. Sounds like a mouthfull, but I know it can be done.
The end text file would then contain something like this (if the second big item was taken out)
user1|pass1|post1|email1|\user3|pass3|post3|email3|\
Here's the access code, should it help
if (-e "../nar/followups/$id.txt") { #if the logfile exists
open (LOGTF, "../nar/followups/$id.txt") || &ErrorMessage;
$typistf = <LOGTF>; #variable assignment
close (LOGTF);
@typistd = split(/\\/, $typistf); #split the BIG arrays
foreach $type (@typistd) { #the foreach loop
@follow = split(/\|/, $type); #split each smaller array
if ($follow[4] eq "") { #if there is no post image
$follow[4] = "general.gif"; #assign this one
}
if ($typist[4] eq "News") { #distinguish between news and rumor
Thanks