programming-examples/perl/SystemFunction/To exit a Perl script, use the die function or the exit function.pl

5 lines
159 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
open(FH, "filename") or die "Couldn't open filename: $!\n";
if ($input !~ /^\d+$/){
print STDERR "Bad input. Integer required.\n";
exit(1);
}