in reply to Reading a VERY LARGE file with SINGLE line as content!

I like this:
open(DAT, $data_file) || die("Could not open file!"); print "file opened successfully!! \n";
Now I would suggest:
while (<DAT>) { ...do something.... ... print if /$pattern/; # simple first attempt }
The above will work as it processes <DAT> line by line and prints.
Now you want a subset of the <DAT> file and start working on how to do that.

Replies are listed 'Best First'.
Re^2: Reading a VERY LARGE file with SINGLE line as content!
by JavaFan (Canon) on Jul 18, 2009 at 00:36 UTC
    That's not really any different from what the OP is doing, is it? The problem is, as explained by the OP, that the file only contains a single line. Reading that single line is a problem. Reading that single line from the guard of a while statement isn't suddenly going to fix it.
      This is a misunderstanding. The disk system (hardware, micro-code on disk hardware, I/F board (hardware and also micro-code) in conjunction with O/S driver and O/S does a lot. I have a prototype IBM drive that after 11 years is failing. I lost a Seagate and a WD drive last year during a massive power failure.

      ALL of these sub-systems thing fail. I am not saying different. The question appeared to be "how to do I simulate a failure"? I tried to help with that question. All hard drives will fail. It is not "if". It is just "when". I tried to help simulate "when". Update:

      OP says that he has 120+ MB of data and no "\n" line breaks. I don't believe that because it is so far out of the norm that a question is reasonable.

        I wonder whether the 1st 2 paragraphs may be in answer to another thread i.e. a cross posting ?

        As for your disbelief, I, for one, _can_ believe it - consider, for example, the case when a file is created in a *NIX environment and then subsequently processed on a Windoze box...or the case when the file comprises a data file.

        A user level that continues to overstate my experience :-))