in reply to email subject issue in mailx

I don't know why you are having a problem — you didn't even say for which values it fails — but the problem might be avoidable by avoiding the shell. Always a good idea anyway.
open(my $fr_uuencode, '-|', uuencode => ( $file ) ) or die $!; open(my $to_mailx, '|-', mailx => ( -s => $subject, -m => 'sam@pull.com', ) ) or die $!; print $to_mailx $_ while <$fr_uuencode>;

Replies are listed 'Best First'.
Re^2: email subject issue in mailx
by mbm (Novice) on Jan 12, 2010 at 18:44 UTC

    Thanks for ur quick response... I tried ur code and faced the error: Can't use an undefined value as filehandle reference at 1.pl line 4. The code I used is:

    #!/tools/sde/frame.sde/bin/perl $subject="I am subject"; $hfile="/aim2/actiview/web/scripts/samweb/perl-lib/mbm/mbm_csv/test1/t +2.csv"; open(my $fr_uuencode, '-|', uuencode => ( $hfile ) ) or die $!; open(my $to_mailx, '|-', mailx => ( -s => '$subject', -m => 'manjunath.bm\@alcatel-lucent.com mbm\@alcatel-lucent.co +m', ) ) or die $!; print $to_mailx $_ while <$fr_uuencode>;
      -s => '$subject',

      Don't know about your "undefined value as filehandle reference" error (Update: actually I do: you seem to have an ancient Perl (pre 5.6.1)), but you likely don't want single quotes around $subject.

      In addition to issues identified by almut,
      'manjunath.bm\@alcatel-lucent.com mbm\@alcatel-lucent.com'
      produces the string
      manjunath.bm\@alcatel-lucent.com mbm\@alcatel-lucent.com
      You want
      'manjunath.bm@alcatel-lucent.com mbm@alcatel-lucent.com'
      or
      "manjunath.bm\@alcatel-lucent.com mbm\@alcatel-lucent.com"