Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2009 21:19:53 +0100 (CET)
From:      "Joost Bekkers" <>
To:        "Tobias Rehbein" <>
Subject:   Re: [perl] sysopen(CD, "/dev/cd0", O_RDONLY | O_NONBLOCK) fails
Message-ID:  <>
In-Reply-To: <20090327185912.GA77908@sushi.pseudo.local>
References:  <20090326212045.GB3134@sushi.pseudo.local> <20090326221128.3a6d648f@gluon.draftnet> <20090327185912.GA77908@sushi.pseudo.local>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Fri, March 27, 2009 19:59, Tobias Rehbein wrote:
> Am Thu, Mar 26, 2009 at 10:11:28PM +0000 schrieb Bruce Cran:
> Hm. Tried this and got ineresting results:
>> use POSIX;
>> sysopen(CD,"/dev/cd0", O_RDONLY|O_NONBLOCK) || perror("sysopen")
> works fine, but
>> use POSIX;
>> sysopen(CD,"/dev/cd0", O_RDONLY|O_NONBLOCK)
>> print "$!"
> prints "No such file or directory"
> Well, I think I'll have to accept that sysopen works but $! does not...
> After
> all sysopen is more important to me ;)

As the perlvar manpage tells us:

  $!      If used numerically, yields the current value of the C "errno"
          variable, or in other words, if a system or library call fails,
          it sets this variable.  This means that the value of $! is
          meaningful only immediately after a failure.

The value of $! is NOT an indicator of success or failure. It only tells
you why something failed. If something succeeded $! is usualy left


Want to link to this message? Use this URL: <>