On Mar 27, 2004, at 12:10 AM, R. Joseph Newton wrote:

Not exactly. It is not the newline "\n" that would give the full output of the
warn function, but the $! variable, which contains the most recent warning or
error message.

I believe you are confusing two often paired, but not otherwise related features of Perl.


warn() is a tool for delivering non-fatal error messages. It behaves differently depending if the provided message does or doesn't end in a newline character, as has been discussed in this thread.

$! is a Perl interface to C's "errno" variable. It is set by failed system/library calls.

While it may often be useful to issue a warn()ing including $!, it is by no means required. It may be useful to issue warn()ings including many variables. $@ is a common example, in fact, it's the default message warn() will display if not provided one. You may want to use your own variables, so simply print a message in your own words about what happened. That's what warn() is for.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to