Hi Rory,
Assuming that if there is a problem in opening the file then it's 0, I
hope the following code helps.
#Code Begings
if (open (INFILE, "<file.txt")) {
$flag = <INFILE>;
close (INFILE);
} else {
$flag = 0;
}
if ($flag == 0) {
$flag = 1;
} else {
$flag = 0;
}
open (OUTFILE, ">file.txt") || die;
print OUTFILE $flag;
close (OUTFILE);
#Code Ends
Regards,
Ahmed
Rory Oconnor wrote:
> I need to touch a file with a "1" in it if a condition is true, and
> either toggle the "1" to a "0" or delete the file (whichever is better,
> probably toggle) if another condition is true. Excuse my
> newbie-ness...but can anyone give me some hints as to the correct syntax
> for that?
>
> thanks,
>
> rory
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]