Home : General : Perl Programming :

General: Perl Programming: Re: [ccc] read a text file and send by mail with perl script: Edit Log

Here is the list of edits for this post
Re: [ccc] read a text file and send by mail with perl script
Hello ccc ,

Remark out the file opening stuff and just
define : my $contents = "Hello world"; and send a test mail to see if you get Hello world .


I suspect you are getting nothing into $content from the file.

Try with caution to the log.txt's file size :

my $content; # define for strict

open(FILE, "/var/log/log.txt") || die "Cant open file. Reason: $!"; # (-:
while(<FILE>) {
$content .=$_; # get all of the file into content including past new lines
}
close(FILE);


second caution :
The above code will suck the entire file into $contents and memory and try to mail it !
Do not try to mail a file contents that is BIG. (-:


Then continue with your mailing part.

Thanks cornball

Last edited by:

cornball: Feb 29, 2004, 8:55 PM

Edit Log: