perl lack global variable/memory for use.But when I look up the doc I find $^M seem to meet this requirement. Below is the introduction of $^M
By default, running out of memory is an untrappable, fatal
error. However, if suitably built, Perl can use the contents of
$^M as an emergency memory pool after "die()"ing. Suppose that
your Perl were compiled with "-DPERL_EMERGENCY_SBRK" and used
Perl's malloc. Then
$^M = 'a' x (1 << 16);
would allocate a 64K buffer for use in an emergency.
But I can't find any excerpt code about this variable. Could someone show code about this? Thanks in advance!
UPDATE:
Sadly, $^M is not for usage of global memory as I expect. It's only for a seldom scenario: when perl is out of memory even can't call die signal function to clean up, then if you define $^M already, perl would free $^M first and gain memory to clean up.
I didn't try it though, but if you are interested in it, you can refer Is $^M a leftover April Fool? to get more discussion about $^M.
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
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.