iic has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I can't get more infomations about this variable from documents coming with Perl. Allocate Memory?Like malloc() in C? I need more explanation for it,how do you use it? Thanks.

Replies are listed 'Best First'.
Re: $^M What is it?
by repson (Chaplain) on Dec 20, 2000 at 11:56 UTC
    According to perlman:perlvar you generally don't.
    -------------
    $^M
    By default, running out of memory it is not trappable. However, if compiled for this, Perl may use the contents of $^M as an emergency pool after die()ing with this message. 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 when in emergency. See the INSTALL file for information on how to enable this option. As a disincentive to casual use of this advanced feature, there is no the English manpage long name for this variable.
    ----------------
    So it is something used just for emergencies and should have no need to appear in general code except possibly mission-critical apps on a machine which is short on memory (so you have enough to continue no matter what other apps are eating memory). Though that scenario should be avoided.