Hello,

It seems in ruby and python we have a good exception capturing way.
The ruby's:

irb(main):042:0> begin
irb(main):043:1*   x=12/0
irb(main):044:1> rescue
irb(main):045:1>   puts "0 div error"
irb(main):046:1> end
0 div error

The python's:

>>> try:
...   x=12/0
... except:
...   print "0 div error"
...
0 div error



But in Perl I have to use an eval:

# perl -e '
eval "$x=12/0";
if ($@) { print "0 div error" }'
0 div error



So what's the equivalent of perl's exception handling like python/ruby?

Thanks in advance.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to