Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: What does the error 'Illegal division by zero' mean?

by davido (Cardinal)
on May 02, 2004 at 05:58 UTC ( [id://349763]=note: print w/replies, xml ) Need Help??


in reply to What does the error 'Illegal division by zero' mean?

The first line of defense against difficult to understand error messages is to put near the top of your script the following line:
use diagnostics;

And when you do that, using your existing script, the terse error message will become the following more verbose and descriptive message:

Illegal division by zero at (eval 15) line 4 (#1) (F) You tried to divide a number by 0. Either something was wrong in your logic, or you need to put a conditional in to guard against meaningless input. Uncaught exception from user code: Illegal division by zero at (eval 15) line 4.

To take advantage of the best Perl has to offer in error messages, warnings, and diagnostics, be sure that your script, at least while under development, starts out with:

use strict; use warnings; use diagnostics;


Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://349763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-18 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found