Define 'give back'... I can't speak to Windows, but for every flavor of *nix I have ever used:
make it re-usable by the current process. There are many situations where perl does this
actually return memory to the OS. This is, in general, not possible. In *nix, once a process is allocated pages, there is no mechanism for giving them back. The only exception to this is memory added via mmap. If you munmap a file, and you are the only process that had it mapped, then this memory is returned to the OS. mmap, however, is typically only used for very specific things, like shared-lib access
'Kind of give it back'. If the memory you are no longer using spans pages, and you have a lot of memory in use, then the system will swap those pages out. They are still considered used by the OS, but they will never actually be put back into RAM. In most situations, this will not occur, because almost nobody wants to run a system that actually has to swap, since it usually comes with a significant performance hit.
update There are definitely situations where malloc does indeed make use of mmap instead of sbrk to obtain memory from the OS, for Linux and BSD. I believe that this is limited to single large allocations (>1MB by default), where there is not already that much contiguous free within the heap.