Hi All
I need to read the contents of the file (2 GB file size) in unix box and then assign into a variable. That time it shows Out of memory error. How to handle this scenario
bash-2.00$ uname
HP-UX
bash-2.00$ ulimit -a
core file size (blocks) 2097151
data seg size (kbytes) 1048576
file size (blocks) unlimited
max memory size (kbytes) unlimited
open files 2048
pipe size (512 bytes) 16
stack size (kbytes) 256000
cpu time (seconds) unlimited
max user processes 5001
virtual memory (kbytes) unlimited
And my code is
my $contents;
open(my $fh, '<', 'control_report_file') or die "cannot open file cont
+rol_report_file $!";
{
local $/;
$contents = <$fh>;
}
close($fh);
bash-2.00$ perl test.pl
Out of memory!
Please, some help would be much obliged!
Thanks
Shanmugam A.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.