I'm learning Perl, and in a lot of the examples I see errors are handled like this

```
open FILE, "file.txt" or die $!;

```

Is `die` in the middle of a script really the best way to deal with an error?