glob needs to carry state for this useful idiom to work: while (my $file = glob '*.txt') { # do something with $file }
while (my $file = glob '*.txt') { # do something with $file }
Which is more friendly to memory than using a list and iterating that.
But one could argue that glob