Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: File::Glob infinite loop with while loop unlike core glob function

by toolic (Bishop)
on Jul 29, 2011 at 16:40 UTC ( #917495=note: print w/ replies, xml ) Need Help??


in reply to File::Glob infinite loop with while loop unlike core glob function

I get no infinite loop when I change the "while" to a "for" loop, if that is a viable trade-off for you:

{ use File::Glob ':glob'; print "======with File::Glob ':glob'======\n"; for (glob "$folder/*.txt") { print "$_\n"; } print "Press <Enter>"; <>; }


Comment on Re: File::Glob infinite loop with while loop unlike core glob function
Download Code
Re^2: File::Glob infinite loop with while loop unlike core glob function
by Gulliver (Monk) on Jul 29, 2011 at 17:44 UTC

    Yes that does what I need, thanks.

    I only noticed this because I was working through the Camel book 'Filename Globbing Operator' section in Chapter 2 where it talks about while magic but the example didn't work for me because I was using File::Glob.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (17)
As of 2015-07-02 12:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (36 votes), past polls