> 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 ...
>       }
>     }
> 
> (putting aside that exception handlers stack).
> 

Yeah.  The latter is not valid syntax in any version of Perl. :)

try {
    $foo = 1/0;
    print "Bar\n";
    CATCH {
          when /division by [zero|0]/ {
               ... ooops ...
          }
    }
}

Luke

Reply via email to