Perl script to check disk usage
There is a bug here:


foreach (@output) {
    if (($_ =~ m/(\d+)% (.*)/) &amp;&amp; ( $1 &gt; $threshold )) {
      chomp($svr); $msg = "$svr: $2 volume  is $1 percent full\n" }
    }



If there are more than one partitions full, $msg will contain only the last one. I think you want to append to $msg instead of overwriting. I suggest to rewrite like this:

chomp(my $svr = `hostname`);

foreach (@output) {
    if (m/(\d+)% (.*)/ &amp;&amp; $1 &gt; $threshold) {
        $msg .= "$svr: $2 volume is $1 percent full\n";
    }
}


Explanation of other improvements:


Removed unnecessary brackets from the if condition
Simplified $_ =~ m// to just m// which does the same
Instead of chomp($svr) for each line, do it only once, right after initialization
Reindented, so it's easier to see the block of code that belongs to the loop


Lastly, you can drop "defined" in if ( defined $msg ) {