You don't want to write directly to a fax machine in perl. Better to write to some fax software in a common format and let it managethe fax transfer. Depending on how fancy you need the fax to look and
what glue layers you have available and what formats your fax software will support some good choices for output format of your program would be TeX, HTML, or plain old text.