Ведение базы данных.
Ведение базы данных:
dbmopen(%last_good, "lastdb", 0666) die "can't dbmopen lastdb: $!"; $last_good{$name} = time; dbmclose(%last_good) die "can't dbmclose lastdb: $!";
Получение информации из базы данных:
#!/usr/local/bin/perl -w dbmopen(%last_good, "lastdb", 0666) die "can't dbmopen lastdb: $!"; foreach $name (sort key (%last_good)) { $when = $last_good{$name}; $hours = (time() - $when) / 3600; write; }
format STDOUT = User @<<<<<<<<<<: last correct guess was @<<< hour ago. $name, $hours .