I'm a very beginner in programming perl. I've installed nagios on my Server and now I want to create a selfmade plugin in perl. My intention is to get the free RAM space of my linux server. I know that such a plugin is programmed before, but I want this for learning. I know, I'll get the free space with "free -m". So i can put this into a variable with

Code

my $free_ram = `free -m`

But now I have to "filter" the output, so that in $free_ram is only the available RAM, which can be used. So my question: How can I filter the output of "free -m"?

Hi, thanks for your answer. I have fixed my problem by taking the uptime and not the free RAM. But now I have a new problem. Now I have a selfmade plugin for nagios and I want to give this plugin some parameters. But how can I do that? I can't use the Nagios plugin for perl because of some demand. My code is: