XP is just a number | |
PerlMonks |
Re^3: anonymous filehandes?by grinder (Bishop) |
on Jul 09, 2007 at 17:21 UTC ( [id://625661]=note: print w/replies, xml ) | Need Help?? |
Is the Perl interpreter smart enough to close files in the same manner as the first example I'm 99.9999% sure that that is the case, without looking at the source. You can use the magic $ARGV variable to see where you are:
When run as "reader f1.txt f2.txt f3.txt" you'll be able to see when the program begins to read from the next file in the list. If you pipe into STDIN, it'll say "reading from -". I believe the most unambiguous terminology is to say that you are reading from the diamond operator. This is not obscure... it's useful. update: Oh, and, if you need to know when you reach the end of a file (not just when the new one begins), you can do that too, with eof.
When I get to that level of convoluted logic, however (especially if lots of other stuff is going on), my head usually explodes. • another intruder with the mooring in the heart of the Perl
In Section
Seekers of Perl Wisdom
|
|