Copyright © tutorialspoint.com

PERL die Function


Syntax

die LIST


Definition and Usage

Prints the value of LIST to STDERR and calls exit with the error value contained in $!.

Return Value

  • Nothing

Example

Following are the usage...

    die "Can't cd to spool: $!\n" unless chdir '/usr/spool/news';
or
    chdir '/usr/spool/news' or die "Can't cd to spool: $!\n"
or
    open( FILEH, ">/tmp/test" ) || die( "Can't open file test $!\n" );

Copyright © tutorialspoint.com