On Aug 7, Allison, Jason (JALLISON) said:

>Can someone explain the interaction of POSIX ERRNO and PERL scripts?  When
>does ERRNO get set and is it set with each PERL call?  I cant seem to track
>when '$!' is set.  Sometimes it will be set to 0, and others 2.  I am having
>difficultly nailing its behavior down.
>
>If there is good reading I am missing, please let me know.

$! is set whenever there is an error from the system, more or less.  This
can happen after a failed chmod() or mkdir() or open() or unlink() call.
$! will only have a meaningful value when there's a failure, which is why
you should only check it if the function being used returns false:

  chmod(...) or warn "chmod error: $!";
  open(...) or warn "can't open xxx: $!";
  unlink(...) or warn "can't unlink xxx: $!";

$! is also magical.  It can be used as a number AND as a string.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to