smtp on perl

#!/usr/bin/perl
# メール送信
# perl mail.pl -from xxxxx@xxxx.com -to sender@xxxx.net -cc xxx@xxxxx.ne.jp -cc xxx@xxxxx.co.jp
use Net::SMTP;
use Getopt::Long;
GetOptions('from=s'=>\$from,'to=s'=>\$to,'cc=s'=>\@cc,'subject=s'=>\$subject);
if ($from eq '' || $to eq '' )
{
  print "Error: from= $from to:$to\n";
  die 'Usage: perl mail.pl -from xxxxx@xxxx.com -to sender@xxxx.net -cc xxx@xxxxx.ne.jp -cc xxx@xxxxx.co.jp'."\n";
}
$smtp_host = 'smtp.xxxx.jp';
$smtp = Net::SMTP->new($smtp_host,
                        Hello=>'hostname.co.jp'   );
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("From:$from\n");
$smtp->datasend("To:$to\n");
foreach $c (@cc)
{
  $smtp->datasend("CC:$c\n");
}
$smtp->datasend("Subject:$subject\n");
$smtp->datasend('Content-Type: text/plain'."\n\n");
while (<STDIN>)
{
  $smtp->datasend($_);
}
$smtp->quit;
print "done.\n";