Please note that "Illegal division by zero" is not a
warning but an
exception, i.e. a fatal error. With a warning, the script will usually print the warning and continue to execute. Not so with "Illegal division by zero": the program will immediately cease to execute (unless you trap the exception). Consider this one-liner:
$ perl -e 'use strict; use warnings; my $c = 1/0; print "we get there\
+n";'
Illegal division by zero at -e line 1.
$
As you can see, the final statement is not executed, we don't even "get there".
Compare to this, where the error is trapped within an eval block:
$ perl -e 'use strict; use warnings; eval {my $c = 1/0;}; print "we
+get there but got the following problem:\n $@ \n";'
we get there but got the following problem:
Illegal division by zero at -e line 1.
$
Here, the program does not die, but checking the value of the
$@ makes it possible for the developer to possibly take other actions than just dying (for example if something can be recovered, so that the error should not be fatal).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.