in reply to Re: nested <FILE> read returns undefined?
in thread nested <FILE> read returns undefined?
Why I did it is simple: I'm reading a file that contains a formatted data set in ascii. If one of the records I'm reading doesn't start with the correct pattern, I skip ahead (in the second loop), looking for the next record.
I feel I'm pretty familiar with the ORA perl book, and nowhere did I ever see anything on for() reading the entire file into memory. Granted, I'm not saying it's not there. I just haven't seen it, and I checked the index everywhere for references to file handles, reading, and so on. It wouldn't occur to me to check for for.
Scaling up my soap box...
IMHO, whether for reads a whole file or not seems to me to be an artifact of implementation that should not affect the logic of the program. If perl feels it can be more efficient this way, then fine--it can do so--but it's a bug to have the kind of effect it has on programs such as the one I illustrated. Indeed, Duff has even pointed out that Perl 6 will "do the right thing", so I probably needn't even point out that the current behavior should be considered a bug. But my minor flame on the subject is what keeps me from getting into worse trouble elsewhere.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: nested <FILE> read returns undefined?
by rjray (Chaplain) on Mar 31, 2006 at 07:03 UTC | |
|
Re^3: nested <FILE> read returns undefined?
by tirwhan (Abbot) on Mar 31, 2006 at 08:14 UTC | |
by argv (Pilgrim) on Apr 01, 2006 at 06:39 UTC | |
by tirwhan (Abbot) on Apr 01, 2006 at 08:28 UTC | |
by argv (Pilgrim) on Apr 01, 2006 at 18:43 UTC | |
by graff (Chancellor) on Apr 02, 2006 at 05:07 UTC | |
by argv (Pilgrim) on Apr 01, 2006 at 06:30 UTC | |
by tirwhan (Abbot) on Apr 01, 2006 at 08:44 UTC | |
by argv (Pilgrim) on Apr 01, 2006 at 18:56 UTC |