in reply to Advanced warning handling?
Note that I'd consider this as being sloppy programming. I think you shouldn't pass wrong arguments to substr(). Instead of worrying about how to trap the condition, you should prevent it from happening.use warnings FATAL => 'substr'; ... eval { substr($str, $really_big_number) }; if ($@) { # an exception is now thrown }
|
|---|