in reply to Re^4: foreach vs while<>
in thread foreach vs while<>

If you have a lock on the file, you can then release it.

I had considered that possibility. That would be

@a = <$fh>; close $fh; for (@a) { .. }

There are reasons to load the file into an array. That's one of them, and I listed four others. But that's not the code the OP posted, and that's not the code I proclaimed should be avoided. You did not contradict me, or do you think I've already contradicted myself four times?

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.