I think output is lost with system - maybe

my $results = `$cmd`;

Also the print is not needed before the EOF.

At Monday, 28 January 2002, "McCormick, Rob E" <rem27920@GlaxoWellcome.
com> wrote:

>Gang,
>
>Using 'df -k' in bash, I can get this to work acceptably:
>
># mail the disk usage for a file system to a recipient 'uid'
>df -k /data/wrc |mailx -s 'host disk usage' [EMAIL PROTECTED]
>
>I'd like to use perl to surround the output of df -k with a simple text
>message.  I used perldoc -q mail to find the code to use sendmail,
but I'd
>like to extend the sendmail example slightly.  My attempt below:
>
>----------------------
>#!/usr/bin/perl -w
>use strict;
>
>my $results = system (`/usr/bin/df -k`);
># backticks seem to be working OK?
>
>open(SENDMAIL, "|/usr/lib/sendmail -oi -t")
>        or die "Can't fork for sendmail: $!\n";
>print SENDMAIL <<"EOF";
>From: <uid\@host>
>To: <email_acct\@acme.com>
>Subject: host disk usage
>
>host disk usage
>print "$results\n";
>EOF
>close (SENDMAIL) or warn "sendmail didn't close nicely";
>---------------------------
>
>The error condition that occurs: mail is created and sent, I receive 
it, but
>the content of the mail is:
>
>host disk usage
>print "65280
>";
>
>Any corrections you could offer that don't involve a module?
>Or is it best to install a module?
>
>Thanks,
>Rob
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>








-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to