in reply to Writing to files

open(FILE, ">>/data.txt") || die "The database could not be opened";

Off the top of my head, I'd say that the file data.txt does not exist in the root directory of the currently active hard drive. Try using the entire file path (i.e. "c:/my/data/goes/here/data.txt").