It depends upon the version and platform of Perl.

Under Windows, perl can and does release some memory back to the OS when it is done with it, as demonstrated below:

c:\test>p1 Name "Data::Dump::MAX_WIDTH" used only once: possible typo at C:\Perl6 +4\bin\p1.p [0] Perl> system qq[ tasklist /fi "pid eq $$"];; Image Name PID Session Name Session# Mem + Usage ========================= ======== ================ =========== ====== +====== perl.exe 5600 Console 1 9 +,972 K [0] Perl> $big = 'x' x 10e6;; [0] Perl> system qq[ tasklist /fi "pid eq $$"];; Image Name PID Session Name Session# Mem + Usage ========================= ======== ================ =========== ====== +====== perl.exe 5600 Console 1 19 +,764 K [0] Perl> undef $big;; [0] Perl> system qq[ tasklist /fi "pid eq $$"];; Image Name PID Session Name Session# Mem + Usage ========================= ======== ================ =========== ====== +====== perl.exe 5600 Console 1 9 +,976 K

And I've heard tell, but cannot verify that under some circumstances, Perl will do the same on some other platforms. YMMV.

But in the end, it is irrelevant, and your trainers should be taken to task for even mentioning it at your stage of learning.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)

In reply to Re: Memory reusability by BrowserUk
in thread Memory reusability by abubacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.