Hi,
To access tables from Database you can use Jeremy Zawodany's Dbix::Dwiw module.
You can store the name and gender in a hash with name as key and gender as value.
You can get the result as a hash from the Dbix:Dwiw module.
Take the input as email-id and parse it using a regex.
You can then to do lookup in the hash.
If you need further help you can send me a pvt.message
HTH
Sharad