in reply to Q: NaN again

Example of "NaN script":
#!/usr/bin/perl use CGI; my $q = new CGI; my $summ = 100; my $peritem = 1; print "Content-type: text/html\n\n"; unless ($q->param('buyit')) { print "<HTML>You have $summ coins.<BR>All items cost $peritem coin +.<FORM>Enter number of items to buy<INPUT type=text name=items><input + type=SUBMIT name=buyit value=go></FORM>"; } else { my $num = int($q->param('items')); my $cost = sprintf("%.2f", $num * $peritem); print "<HTML>You try to buy $num items, for $cost coins.<BR>"; if ($cost > $summ) { print "You have not enough money<BR>"; } elsif ($cost < 0) { print "Invalid number<BR>"; } else { $summ-=$cost; print "You buy $num items for $cost coins. You have $summ coin +s left<BR>"; } }
Results:
** 23 coins: You try to buy 23 items, for 23.00 coins. You buy 23 items for 23.00 coins. You have 77 coins left ** 102 coins: You try to buy 102 items, for 102.00 coins. You have not enough money ** -3 coins: You try to buy -3 items, for -3.00 coins. Invalid number ** nan coins: You try to buy nan items, for nan coins. You buy nan items for nan coins. You have nan coins left