Hello Masters of Perl stuffs.


This is most likely a "newbie" question here. My script below used to work on solaris, but stopped working correctly right about the time I installed the most recent recommended maintenance update cluster from sun. It used to email me the contents of my pretty, edited array "@quota" using the sendmail module. Now it just emails me a blank email. For future reference, what is the best way to take the contents of an edited array, such as in this script, and send its contents via email? I tried following the recipies in Oreilly's Perl Cookbook, but I got the same results :-(

#!/usr/local/bin/perl # use Mail::Sendmail; $mailhost = "mail_server"; $fromaddress = "me@.com"; $toaddress = "me@.com"; %mail = ( From => $fromaddress, Subject => "server Quota Report", Smtp => $mailhost, To => $toaddress, ); # Define Global Variables # Percentage Quota used that triggers a warning to the user. $warnquotapct = 25; # Netapp mixed mode filer my @quota = `rsh server_name quota report -x`; #Remove the top 3 lines from the quota output (header) shift(@quota); shift(@quota); shift(@quota); foreach $line (@quota) { chomp($line); ($ignore, $user, $vol, $tree, $used, $limit, $thresh, $ignore, $ignore +, $ignore) = split(/\s+/, $line); next unless ($user); $user = lc($user); next if ($user eq "\*"); next if ($user eq "root"); next if ($user eq "builtin\\administrators"); next if ($used <= "0") || ($used eq ""); # # Below line is for server right now limit = "-" # next if ($limit eq "-") || ($limit eq ""); # Strip out the "NT_DOMAIN\" prefix to the username if it's there. $user =~ s/NT_DOMAIN\\//; $used = $used / 1000; $quota = $quota / 1000; $limit = $limit / 1000; $usedquotapct= $used / $limit *100; $remainingquota = $limit - $used; if ($usedquotapct >= $maxquotapct ) { printf ("$user\'s disk usage \= %.2f MB.\nHas %.2f MB availabl +e.\nQuota set to: %.2f MB\n\n", $used, $remainingquota, $limit); } } print("\nSending email..."); sendmail(%mail) || print "Error: $Mail::Sendmail::error\n"; print("Complete\n");

In reply to 'Best way to email edited array contents? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.