User perl to get memory installed in a machine

I currently have a statistics gathering script i run on my Linux servers. One of the stat i gather is total memory in the machine. The script is all perl with the exception of gathering the memory for that i use the following command:

 $ram = (`cat /proc/meminfo |  grep "MemTotal" | awk '{print \$2}'`);

Is there a way to do this with an internal perl command (modules would work too, however to install them i need to go through a change management process). I just want to make it a pure perl script, not that it will make it any better i just want to.

thanks,

Sean

Check the Linux::MemInfo module at cpan:

$ 
$ cat /proc/meminfo |  grep "MemTotal" | awk '{print $2}'
961528
$ 
$ perl -le 'BEGIN{use Linux::MemInfo} %mem=get_mem_info; print $mem{"MemTotal"}'
961528
$ 
$ 

tyler_durden