home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam

Programming Perl


3.2.35 exit

exit 

EXPR

This function evaluates EXPR and exits immediately with that value. Here's a fragment that lets a user exit the program by typing x or X :

$ans = <STDIN>;
exit 0 if $ans =~ /^[Xx]/;

If EXPR is omitted, the function exits with 0 status. You shouldn't use exit to abort a subroutine if there's any chance that someone might want to trap whatever error happened. Use die instead, which can be trapped by an eval .


3.2.34 exists Book Index 3.2.36 exp

[ Library Home | Perl in a Nutshell | Learning Perl | Learning Perl on Win32 | Programming Perl | Advanced Perl Programming | Perl Cookbook ]







(追記) (追記ここまで)


(追記) (追記ここまで)


AltStyle によって変換されたページ (->オリジナル) /