And for the ram used by perl you can do this also...
print `memstat |grep perl`;
you can ask for a specific process also, following the former example
print `memstat -p 28892`;
__END__
592k: PID 5273 (/usr/bin/perl)
116k( 108k): /lib/ld-linux.so.2 28892
92k( 84k): [08:01]:258781 28892
44k( 36k): [08:01]:258783 28892
16k( 8k): [08:01]:258784 28892
152k( 144k): [08:01]:258791 28892
1372k( 1356k): [08:01]:258796 28892
1404k( 1396k): /usr/bin/perl 28892
1500k( 0k): [08:06]:242490 28892
--------
5288k ( 3132k)
for memory use inside a specific part of a perl script see also malloc() and memstat() or -DL and warn('!') marks |