in reply to Re^4: File::Glob infinate loop with while loop unlike core glob function
in thread File::Glob infinite loop with while loop unlike core glob function

You can also see that there no magic involved (just wantarray) if you UTSL, GLOB_NOMAGIC option notwithstanding.
The "magic" is not in detecting the context in which you are invoked, it is in returning different scalar values when invoked with the same argument. This is not your math teacher's concept of a function. If you run this
#!/usr/bin/perl -w use strict; use feature 'say'; say scalar(glob('*')); say scalar(glob('*')); say scalar(glob('*')) for (1..2);
in a directory with more than one file, you'll get the same file, twice, then the same file and a different one. There's obviously some "hidden state" beyond scalar context. I choose to call this "magic", you can choose otherwise.
  • Comment on Re^5: File::Glob infinate loop with while loop unlike core glob function
  • Download Code