From: Ken Lehman <[EMAIL PROTECTED]>
> I want to be able to return a true or false value from a function in a
> module and populate the $! variable with the specific errors. Is this
> possible? Is there documentation on how to do this? I can find docs on
> how to use $! but not how to set it. Thanks for any help -Ken

You can set $! ... but not to a specific error.

Try
        foreach (0..30) {
                $! = $_;
                print "$!\n";
        }
and
        $! = "Hello world";
        print "$!\n";

As you can see you can assign the error numbers, but not the 
messages, those are fixed.

You need to use another variable to hold the error message.

You may also want to die("with the message") and wrap the code in an 
eval{} block.

See
        perldoc -f eval

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
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