Re: How to capture an div 0 exception

2016-05-18 Thread Richard Hainsworth
On Wednesday, May 18, 2016 11:40 PM, Brandon Allbery wrote: On Wed, May 18, 2016 at 11:29 AM, Brandon Allbery > wrote: On Wed, May 18, 2016 at 11:27 AM, mt1957 > wrote: This has

Re: How to capture an div 0 exception

2016-05-18 Thread mt1957
Hi Richard, This has something to do with lazy evaluation. It triggers the calculation when it wants to show the value in $r. So commenting out the first 'say' will error on the second with the shown response. The CATCH is not at the same scope than the second 'say' statement so there you

Re: How to capture an div 0 exception

2016-05-18 Thread Richard Hainsworth
Marcel and Moritz, Thank you for the fast response. I have been experimenting with the code you sent, but still do not understand something. To illustrate, here is another snippet: use v6; my $r; for 0..4 -> $s { { $r = 5 / (3 - $s); say "At line $?LINE r is $r"; CATCH {