in reply to Sending mail help

Using a Here-doc like that is just like using a double quoted string, and fuction calls don't interpolate inside a double quoted string without some (IMHO ugly) "magic". You could try something like:
print SENDMAIL << "EOF"; From: me\@abc.com To: you\@xyz.com EOF print SENDMAIL fuction(arguments); close(SENDMAIL);
Or assign the return value of the function to a variable, and put that inside the heredoc to interpolate normally.
my $text = function(arguments); print SENDMAIL << "EOF"; From: me\@abc.com To: you\@xyz.com $text EOF close(SENDMAIL);