On Tue, 20 Aug 2002, Michael C. Podlesny wrote:

> What is the proper syntax to for division in PERL?
>
> I wrote:
>
> $a = $b/$c*100;
>
> This doesn't work.  Does anyone know why?

Make sure that $b and $c are being treated as numeric, not strings. You
can force them numeric by subtracting zero, like so:
  $b -= 0; $c -= 0;

If your code is CGI/ASP, and you're getting the vars from GET or POST,
they are probably strings by default, and you'll want to force this type
of conversion on variables that you need to be treated as numeric.

-- 
Ernest MacDougal Campbell III, MCP+I, MCSE <[EMAIL PROTECTED]>
http://dougal.gunters.org/             http://spam.gunters.org/
  Web Design & Development:  http://www.mentalcollective.com/
       This message is guaranteed to be 100% eror frea!

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to