Welcome to WebmasterWorld Guest from 22.214.171.124
I wrote this perl sript and it should move the file
to the other directory after the mail was sent.
I get this error message:
"Useless use of string in void context at mail.cgi line 75.
Can't call method "move" without a package or object reference at mail.cgi line 75."
knows someone what's wrong and how to correct it?
my $recipient = "recipient\@mydomain.net";
my $linux = "root\@mydomain.net";
my $file = "/var/tmp/file.txt";
# read the file
open(FILE, $file) ¦¦ die "Cant open file. Reason: $!"; # (-:
$content .=$_; # get all of the file into content including past new lines
# send the mail with file content
open(MAIL, "¦/usr/sbin/sendmail -t") ¦¦ die "Cant send mail. Reason: $!";
print MAIL "from:$linux\n";
print MAIL "to:$recipient\n";
print MAIL "subject:Hi!\n";
print MAIL "$content \n\n";
print MAIL "Time: ", scalar localtime, "\n";
#move file to the new directory and remove it at the old location
move $file, "/var/backup";