in reply to subtracting numbers
if ($number >= 10 ) { captures all numbers greater-or-equal than 10: 10, 11, 20, 50 etc.
When you enter 10 50, it is matched by if ($number >= 10 ) { but also by if ($number >= 20 ) { and also by if ($number >= 50 ) { and so on.
If I understand correctly you want to match ranges: 10-20 or 20-50. But not both. One way to achieve this is to use an elsif
if( $number >= 50 ){ $sendthis = $number - 4; } elsif( $number >= 20 ){ $sendthis = $number - 3; } elsif( $number >= 10 ){ $sendthis = $number - 2; }
Notice that you start checking for the greatest number in the range (50) and go down. Also notice that indenting (append tab or spaces in code within code-blocks) makes reading code easier.
bw, bliako
|
|---|