PDA

View Full Version : small number problem


cooldaddy
11-05-2005, 01:17 PM
Hi, I've got this small problem which is really irritating. I got two values in my script, $number and $numbermax. I calculate 90% of the number in $numbermax and store that value in $perc, nothing special. The script then checks if $number is higher then $perc, if so it shoot print out the word "whoot". But somehow with it allways seems to print out 'whoot', even when $number is smaller then $perc. How come ?

$number=10;$numbermax=225;

my $perc=(($numbermax/100)*90);
$perc=int($perc);$pagina=int($number);
print "..$number.. ..$perc..";
if ($number => $perc){
print "whoot";
}

FishMonger
11-05-2005, 02:40 PM
change
if ($number => $perc)

to
if ($number >= $perc)

cooldaddy
11-05-2005, 02:42 PM
thanks fishmonger

FishMonger
11-05-2005, 02:47 PM
Your welcome

Do you understand the difference between them?

The first one creates an anonymous hash. The second does a comparison.