Thread Illegal division (4 answers)
Opened by Froschpopo at 2007-03-14 19:53

bloonix
 2007-03-15 10:40
#75049 #75049
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
[quote=Froschpopo,14.03.2007, 18:53]Kann ich die Message auch irgendwie möglichst ohne eval abfangen?
Dadurch wird jedesmal ein exit ausgelöst. Ich würde lieber ein kontrolliertes "die &programm_beenden()" machen.[/quote]

Du brauchst kein eval! Dein Skript soll ja auch nicht in einer
eval-Flut untergehen! Eine if-Anweisung sollte ausreichen.

Code: (dl )
1
2
3
4
5
6
7
8
my $x = 23;
my $y =  0;

print $y > 0 ? $x/$y : 0, "\n";

# oder

die "fehler ...." if $y == 0;
\n\n

<!--EDIT|opi|1173948212-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread Illegal division