has described a method in one of his books
(can't remember which , but read most of them - it's worth your while if you are interested in thing relating to computer security), by which it is possible to conduct a secure, secret and verifiable ballot. It's possible to see who has voted, and to sum the votes for each candidate, and each voter can verify that his/her vote is correct, but noone can discover what each voter voted.
IMHO one of the problems is not just the ballot counting, but the voter registration - I'm still amazed that the US does'nt have an upto date registry over the inhabitants their whereabouts etc. so a complete list of voters easily (and without the almost neverending legal squabbles) can be produced.
But none of this refers to perl in any way.
Update: Just remembered! I think that it's in Beyond Fear. The covernotes include: Will computerized voting machines make election results more accurate?