in reply to File::Glob infinite loop with while loop unlike core glob function
No, I don't think it is a bug. glob returns a list. In scalar content, as while establishes, you just get the last element of the list. In this case, it is a non-empty string, so it acts as true, and it never changes, so there is an infinite loop. If you do
the list, in array context, turns into a real array, over which you can iterate with your favorite iterator.@files = glob "$folder/*.txt";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: File::Glob infinite loop with while loop unlike core glob function
by Gulliver (Monk) on Jul 29, 2011 at 18:11 UTC | |
by jpl (Monk) on Jul 29, 2011 at 18:30 UTC | |
Re^2: File::Glob infinate loop with while loop unlike core glob function
by Anonymous Monk on Jul 29, 2011 at 23:41 UTC | |
by jpl (Monk) on Jul 31, 2011 at 17:43 UTC | |
by Anonymous Monk on Jul 31, 2011 at 21:10 UTC | |
by jpl (Monk) on Aug 01, 2011 at 13:55 UTC | |
by jpl (Monk) on Aug 01, 2011 at 10:45 UTC |
In Section
Seekers of Perl Wisdom