in reply to Fileglob in scalar context question

The <GLOB> (or glob()) operator, in scalar context, returns one element at a time. And since this is the same glob(), it retains its state (it knows what to return next). Since glob("foo.bar") returns just one element (and undef the next time to signify the end of the files found) you get the filename the first time, and then undef the next.

japhy -- Perl and Regex Hacker
  • Comment on Re: Fileglob in scalar context question