in reply to Alternate for "open"
Please show the code you are using to open and read your file.
open() shouldn't use up your memory, but reading the file might. Perhaps you are trying to read it all into memory at once? That will cause problems with large files; better to just handle one line at a time in memory.
Try something like:
HTH!my $filepath = '/path/to/huge/file'; open my $fh, '<:encoding(UTF-8)', $filepath or die $!; while ( my $line = <$fh> ) { # process one line at a time } close $fh or die $!;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Alternate for "open"
by ravi45722 (Pilgrim) on Nov 16, 2015 at 08:16 UTC | |
by Corion (Patriarch) on Nov 16, 2015 at 08:27 UTC | |
by 1nickt (Canon) on Nov 16, 2015 at 15:18 UTC | |
by ravi45722 (Pilgrim) on Nov 17, 2015 at 04:53 UTC | |
by Corion (Patriarch) on Nov 17, 2015 at 07:35 UTC | |
by Preceptor (Deacon) on Nov 16, 2015 at 17:24 UTC |