On Thu, Aug 02, 2001 at 02:31:28PM -0400, Bob Showalter wrote:
> P.S. I'm surprised this works with while(). I didn't realize fileglobs
> were magical inside while(), but it appears they are... Is this documented?
Yes, perldoc perlop, in the I/O Operators section (5.6.1 version):
A (file)glob evaluates its (embedded) argument only when it is
starting a new list. All values must be read before it will start
over. In list context, this isn't important because you automatically
get them all anyway. However, in scalar context the operator returns
the next value each time it's called, or "undef" when the list has run
out. As with filehandle reads, an automatic "defined" is generated
when the glob occurs in the test part of a "while", because legal glob
returns (e.g. a file called 0) would otherwise terminate the loop.
Again, "undef" is returned only once.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]