Is this behavior intentional? Yes. In Perl files work about the same way they work in most languages. You open a file and then you read from start to end. Once you are at the end you can't read anymore unless you perform a seek.
Should I have known this to begin with? Hard to say. Let's just say that it is good that you know it now.
Does this behavior serve any purpose or have any benefit? Yes. It encourages "one-pass" processing of files. In other words it is more efficient to only read a file once (start to end). Structuring your code so that you don't need to make multiple passes through a file will make your program consume less resources and will most likely make your program more efficient.
In reply to Re: Trying to do multiple while loops on the same input file
by zek152
in thread Trying to do multiple while loops on the same input file
by elef
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |