in reply to Some simple math and absolute values
$wt = $ARGV[0]; $min = 1; $price = 10; while ($wt ne '') { $wt = $min if abs($wt)< $min; print "Price: " $wt * $price, "\n"; print "Next Weight: "; chomp($wt = <stdin>); } [download]