Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Some help with my project:

by marto (Cardinal)
on Jan 17, 2017 at 14:50 UTC ( [id://1179757] : note . print w/replies, xml ) Need Help??


in reply to Re^2: Some help with my project:
in thread Some help with my project:

my $monit_percentual = (  $avail  /  $avail+$used  ) * 100 ;

"it will prevent these kind of error if future"

If you want to prevent errors be aware of perlop "Operator precedence and associativity".

use strict; use warnings; my $avail = 1; my $used = 1; my $testa = ( $avail / $avail + $used ) * 100; my $testb = ( $avail / ( $avail + $used ) ) * 100; print "testa: $testa\ntestb: $testb\n";