- or download this
total used free shared buffers cached
Mem: 189656 180144 9512 0 6976 81012
- or download this
my @lines = `free`; # run command, store output
chomp (@lines); # remove all newlines.
- or download this
my @field_names = split (' ', $lines[0]); # split 1st line
- or download this
my @mem_sizes = ( $lines[1] =~ m/(\d+)/g );
- or download this
my %free; # a hash, where the fields will get stored
- or download this
@free { @field_names } = @mem_sizes;
- or download this
print("Cached: ", $free{'cached'}, "\n");
- or download this
@free { @field_names } = @mem_sizes;