On Nov 13, 7:11 pm, [EMAIL PROTECTED] (Marco) wrote:
> Hi...
>
> Can someone help me on this? Actually I can get the dara from the
> system()...But it shows "0" when I print the $result...How can I
> assign the system() to $result ?....Thanks...
>
> here below is the code...
>
> $inact = "cat /proc/meminfo | grep -w Inactive | sed 's/^.*Inactive: //
> g' | sed 's/kB//'";
> $result = system(cat /proc/meminfo | grep -w Inactive | sed 's/
> ^.*Inactive: //g' | sed 's/kB//');
> print $result;

If you prefer to not use the Linux::MemInfo module, you can do the
following (but I think the module is a better approach):

open my $meminfo, '/proc/meminfo' or die $!;
while( <$meminfo> ) { print $1 if /Inactive:\s+(\d+)/; }


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to