Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: When do filehandles close?

by gaal (Parson)
on Jul 23, 2004 at 08:01 UTC ( #376824=note: print w/replies, xml ) Need Help??


in reply to Re^3: When do filehandles close?
in thread When do filehandles close?

(Thanks for the typo spotting; fixed.)

The $. behavior here is correct, if highly magical. Perl is keeping track of a property of an object that doesn't exist any more.

(Or, looking at it another way, it's not magical at all: $. is a global that gets set whenever a filehandle is accesed. Even if the handle is closed, the global remains. But there's still something DWIMmish going on, because each (active) filehandle does remember its own line number, so that when you access two files in alternation, $. knows how to keep track.

s/line number/record number/g for exactness.)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-12-06 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?