In a message dated Tue, 15 Oct 2002, Michael G Schwern writes: > On Tue, Oct 15, 2002 at 01:44:50PM -0500, Jonathan Scott Duff wrote: > > People have used the terms "error" and "exception" interchangably in > > this disucssion. To me, an "error" is something that stops program > > execution while an "exception" may or may not stop execution depending > > on what the user decides to do about exceptions. > > Unless I've missed my mark, Perl errors have always been trappable [1]. Does > that make them exceptions? We've been calling them errors for years now.
The Perl trainers I've seen have been calling Perl errors "exceptions" for years now, mostly, I think, to shut up the Javaphiles who think that they're the only ones that have such a wondrous and unprecedented thing (at least, that's why I always did it ;-) > Put another way, is there a significant difference between: > > eval { > $foo = 1/0; > print "Bar"; > } > if( $@ =~ /^Illegal division by zero/ ) { > ... oops ... > } > > and > > try { > $foo = 1/0; > print "Bar"; > } > catch { > when /^Illegal division by zero/ { > ... oops ... > } > } None that I can see. Trey