Home: Perl Programming Help: Beginner:
BUILT IN in-place editing?



Tim Mousel
Deleted

Jun 4, 2000, 2:14 PM


Views: 1209
BUILT IN in-place editing?

Hi,

For a membership script I'm trying to remove expired accounts.

$membershiplength = 30;
$expires = time() + (86400 * $membershiplength);
$current = time();

Here is the format of my data file:
$username:$password:$pass:$trans:$email:$expires:$date

I can't figure out how to delete the expired accounts from my file. I'm thinking something like the following but I think I'm way off:

sub delete_expired
{
use Fcntl ':flock'; # for LOCK_EX
open PASS, "<$password_file" &#0124; &#0124; &error('System Error. Password file was not able to be read.');
flock PASS, LOCK_EX;
$_ = do { local $/, <PASS> };
$expired = ????????
#print PASS;
close PASS;

exit;
}
}


Any suggestions would be greatly appreciated!

Tim