I am working on an assignment for my Perl class where my script goes out to a web site, extracts some information and is supposed to email the relevant information to an email address specified in the command-line argument. So far, I am able to extract the information from the web, parse through it with regular expression, and I know how to get the email to work. Here is what I need help with. I need to format the output that is sent in the body of the email. For example, each column can only be a certain width, all numbers must be the same size (filled in with 0's if needed). I am confused because it looks to me like the body of the email will be saved into a single scalar and then sent as an argument to the email function.

How can I construct this single scalar so that it is formatted correctly? Currently, I have pulled all of the data I need and saved it into arrays... one array for each of the six columns I need in the output.

Thank you very much for any help on this.


First of all, I would like to thank you for that link. I have the format working perfectly. My new problem comes with the sendmail function however. If I use the write; function, I can print my data to the screen and it is formatted properly. How can I save this to a scalar or otherwise to get it into the sendmail function as the subject?

Thanks for your help.


have you tried:

write MAIL;

where MAIL is the currently opened filehandle that prints the email message.

This article has been dead for over six months. Start a new discussion instead.