Re: Loop controls

2002-05-02 Thread Damien Neil
On Wednesday, May 1, 2002, at 02:27 PM, Aaron Sherman wrote: unless my $fh = $x.open { die Cannot open $x: $!; } else while $fh.getline - $_ { print; } else { die No lines to read in $x; } I think you need a better

Re: Loop controls

2002-05-02 Thread Aaron Sherman
On Wed, 2002-05-01 at 18:47, Damien Neil wrote: On Wednesday, May 1, 2002, at 02:27 PM, Aaron Sherman wrote: unless my $fh = $x.open { die Cannot open $x: $!; } else while $fh.getline - $_ { print; } else { die No lines to read in $x;

eval {} or carp blah: $@

2002-05-02 Thread Jim Cromie
with p5, Ive often written eval {} or carp $ blah; it seems to work, and it reads nicer (to my eye) than eval {}; if ($) {} but I surmise that it works cuz the return-value from the block is non-zero, for successful eval, and 0 or undef when block dies, not cuz of magical treatment of $@.

Re: eval {} or carp blah: $@

2002-05-02 Thread Luke Palmer
On Thu, 2 May 2002, Jim Cromie wrote: with p5, Ive often written eval {} or carp $ blah; it seems to work, and it reads nicer (to my eye) than eval {}; if ($) {} but I surmise that it works cuz the return-value from the block is non-zero, for successful eval, and 0 or undef when

Re: eval {} or carp blah: $@

2002-05-02 Thread Dave Mitchell
On Thu, May 02, 2002 at 02:33:42PM -0600, Jim Cromie wrote: with p5, Ive often written eval {} or carp $ blah; You generally Don't Want To Do That. If the eval succeeds, but the last statement in the eval happens to come out as false, then it'll still carp: $a = 0; eval { 1 $a } or

Re: eval {} or carp blah: $@

2002-05-02 Thread Peter Scott
At 02:33 PM 5/2/02 -0600, Jim Cromie wrote: eval {} or carp $ blah; it seems to work, and it reads nicer (to my eye) than eval {}; if ($) {} % perl -le 'eval { print No exceptions here; 0 } or warn $ blah' No exceptions here blah at -e line 1. -- Peter Scott Pacific Systems Design

Re: eval {} or carp blah: $@

2002-05-02 Thread Damian Conway
Jim Cromie wrote: with p5, Ive often written eval {} or carp $ blah; it seems to work, modulo any block that returns false :-( and it reads nicer (to my eye) than eval {}; if ($) {} but I surmise that it works cuz the return-value from the block is non-zero, for successful