There are a number of ways to do this - use one of the CPAN modules available (like Mail::Sendmail), use mail or use sendmail.
Here's an example using sendmail :
#!/usr/local/bin/perl
open (SENDMAIL, "| /usr/bin/sendmail -t -i"); # The -t is so sendmail scans the message for recipients (To:, Cc:, Bcc:)
# The -i is so sendmail doesn't interpret a line with only a . as the end of file
print SENDMAIL << 'EOF';
To:to@domain.com
From:from@domain.com
Subject:subject
body of
the mail
EOF
close(SENDMAIL);
|