CHIANG, Water Y. C. wrote, on Saturday, April 29, 2000 10:18
: I'm a freshman in perl. Did someone know how to write a perl program to
: return a value to DOS mode on Windows 95 and NT Workstation? Thanks and
You might mean "exit":
perldoc -f exit
exit EXPR
Evaluates EXPR and exits immediately with that value.
Example:
$ans = <STDIN>;
exit 0 if $ans =~ /^[Xx]/;
See also `die()'. If EXPR is omitted, exits with `0'
status. The only universally recognized values for EXPR
are `0' for success and `1' for error; other values are
subject to interpretation depending on the environment
in which the Perl program is running. For example,
exiting 69 (EX_UNAVAILABLE) from a *sendmail* incoming-
mail filter will cause the mailer to return the item
undelivered, but that's not true everywhere.
Don'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()'.
The exit() function does not always exit immediately. It
calls any defined `END' routines first, but these `END'
routines may not themselves abort the exit. Likewise any
object destructors that need to be called are called
before the real exit. If this is a problem, you can call
`POSIX:_exit($status)' to avoid END and destructor
processing. See the perlsub manpage for details.
EXPR is the return code just like any other DOS program, testable in a
batch file and such.
Of course, if you really just want to output to the screen (console)
you can just use "print" with STDIN as the handle (or no handle: STDIN
will be assumed):
print "Here's some output from my perl program!\n";
Hope that helps,
Joe
==============================================================
Joseph P. Discenza, Sr. Programmer/Analyst
mailto:[EMAIL PROTECTED]
Carleton Inc. http://www.carletoninc.com
219.243.6040 ext. 300 fax: 219.243.6060
Providing Financial Solutions and Compliance for over 30 Years
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]