------------------------------------------------------------------------------- Perl Exception handling In perl is achieved with eval { die "Oops"; }; warn $@ . "\t...caught" if $@; That prints out: Oops at - line 2. ...caught at - line 4. In Perl 5 you can just write that as: eval { die "Oops"; }; warn if $@; Similarly, "die if $@" will append "\t...propagated". This also catches internal run-time errors: eval { $foo / 0; }; will produce a $@ "Illegal division by zero". If you want to catch compile-time errors as well, then instead of eval {...}; you use an ordinary eval "..."; or, more likely, eval $string; If you want a full-blown recovery block, you can write it like this: eval $your_ad_here; if ($@) { if ($@ =~ /syntax error/) { ... } elsif ($@ =~ /division by zero/) { ... } elsif ($@ =~ /EOF in string/) { ... } elsif ($@ =~ /Oops/) { ... } else { die $@, "...propagated" } } Note that the same exception handler can handle both compile-time and run-time errors. Escape codes are transmitted as strings rather than as numbers, but you can always encode a number into a string if you want. Tom has implemented a set of catch/throw routines that do something like you want. By the way, I noticed you used "goto" in your implementation. In Perl 4, goto isn't powerful enough to do what you want. It only works when the target is not in a subroutine. Perl 5's goto is a little more general. But you've got the right idea. Larry -------------------------------------------------------------------------------