Search notes:

Perl function: die

Signal handler for die

#!/usr/bin/perl
use warnings;
use strict;

$SIG{__DIE__} = sub {
   print("The programm died: @_");
   exit(-1);
};


for my $word ( qw( foo bar bla baz ) ) {

   unless ($word eq 'foo' or $word eq 'bar' or $word eq 'baz') {
     die "word $word was found";
   }
   print "word is $word\n";

}
Github repository about-perl, path: /functions/die/SIG.pl

Using croak rather than die in modules

Within perl modules, croak is a better die.

See also

Perl functions

Index