in reply to Re^5: write to Disk instead of RAM without using modules
in thread write to Disk instead of RAM without using modules

I am unable to understand how to load first file in memory and sequentially read other files. can you please help me with my script or exemplify with a short script. Any help will be appreciated.
  • Comment on Re^6: write to Disk instead of RAM without using modules

Replies are listed 'Best First'.
Re^7: write to Disk instead of RAM without using modules
by Corion (Patriarch) on Oct 25, 2016 at 07:58 UTC

    The following code reads a file line by line:

    my $filename = 'some/filename.txt'; open my $fh, '<', $filename or die "Couldn't read '$filename': $!"; while (<$fh>) { ... }

    If you want to store information about a file, do so while reading it line by line.

      I need to open and compare multiple files and not open just one file. So I have to open files sequentially and compare. I am unable to get that through.

        Maybe you can repeat the code to open one time a second time and give it a different filename this time?

        Maybe now is a good time to revisit some introductory material on Perl. Maybe Modern Perl helps you. It is even available at no cost as a PDF download.

        I am sorry for posting again and again but as suggested by Laurent_R, load one file in memory and read all other files sequentially. I am unable to get through that as how to load one file in memory and open rest of the file sequentially for comparison.
        can you please suggest what is wrong with my script. I am opening each file turn by turn and pusing the value in hash. all the matching records are being stored together. Please help me with the modification in my script. Thanks