Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: do-ing of file without \n at the end

by sawoy (Initiate)
on Mar 31, 2007 at 04:38 UTC ( [id://607604]=note: print w/replies, xml ) Need Help??


in reply to Re: do-ing of file without \n at the end
in thread do-ing of file without \n at the end

ok, understood. i'll check all supported code for not full correct check of do() execution :

And now issue transforms to:
- create file 'test.pl' with content:
print "err = '$!'\n"; exit 0;
without \n in the end

- run file by command like:
`perl ./test.pl`

- see in output:

$ perl ./test3.pl
err = 'Bad file descriptor'

and question now is "why perl sets $! for file w/o \n in the end"...

Thanks,
alex|sawoy|slex

Replies are listed 'Best First'.
Re^3: do-ing of file without \n at the end
by sgifford (Prior) on Mar 31, 2007 at 06:31 UTC
    $! is undefined if no error has occured, and so can be set to absolutely anything. It's not clear to me why Perl ends up setting it to this particular value under these circumstances (I see the same thing on my machine), but that's really a trivia question; since the behavior is undefined, any value is valid.
      Bad file descriptor is error 0 on some systems. It means someone did $! = 0; under the false assumption that 0 meant success. Or as a favour for those who make that assumption.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://607604]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-19 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found