I still don't think that's right, at least for my system, running Linux.  It might be somehow different because you're using a ramdisk, but when I run this program:
#!/usr/bin/perl -w + my $iam = $0; my $lscmd = "ls -lt $iam"; my $dfcmd = "df --block-size=1 ."; + printf "Before remove\n"; system($lscmd); system($dfcmd); sleep 1; unlink $0; printf " After remove\n"; system($lscmd); system($dfcmd); sleep 1; printf "Try ^Z to see for yourself (cmd: $dfcmd) ...\n"; sleep 5; printf "Now exiting the program\n";
it clearly shows that the space is freed up *before* the program exits.  The free space goes from 44290686976 bytes to 44290691072 (a difference of 4096 bytes) and remains at that value until after the program completes.  
[liverpole@golux ~/perl]% chmod +x rmtest2 [liverpole@golux ~/perl]% ls -lt rmtest2 -rwxrwxr-x 1 liverpole liverpole 352 Oct 7 12:25 rmtest2* [liverpole@golux ~/perl]% rmtest2 Before remove -rwxrwxr-x 1 liverpole liverpole 352 Oct 7 12:25 rmtest2 Filesystem 1-blocks Used Available Use% Mounted on /dev/hda2 77584592896 29352763392 44290686976 40% / After remove ls: rmtest2: No such file or directory Filesystem 1-blocks Used Available Use% Mounted on /dev/hda2 77584592896 29352759296 44290691072 40% / Try ^Z to see for yourself (cmd: df --block-size=1 .) ... Suspended [liverpole@golux ~/perl]% ls -lt rmtest2 ls: rmtest2: No such file or directory [liverpole@golux ~/perl]% df --block-size=1 . Filesystem 1-blocks Used Available Use% Mounted on /dev/hda2 77584592896 29352759296 44290691072 40% / [liverpole@golux ~/perl]% fg rmtest2 Now exiting the program [liverpole@golux ~/perl]% df --block-size=1 . Filesystem 1-blocks Used Available Use% Mounted on /dev/hda2 77584592896 29352759296 44290691072 40% /

In reply to Re^4: Deleting a file after it runs? by liverpole
in thread Deleting a file after it runs? by Spidy

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.