Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: File::Glob infinate loop with while loop unlike core glob function

by jpl (Monk)
on Aug 01, 2011 at 10:45 UTC ( #917812=note: print w/ replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2014-09-21 20:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (175 votes), past polls