Yes of course, in this situation. The reason it works is because file handles are iterators remembering where they left off and because our condition was simple. There are far more situations in which it wouldn't work so the meditation is on the idea of dynamically splicing in code blocks while code is running and what neat things might you do if the functionality existed without heavy penalties.