The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/local/bin/perl -w
use Tk;
use Tk::widgets qw(ProgressBar);

my $mw = MainWindow->new;
my $info = `cat /proc/meminfo`;
my ($max) = $info =~ /MemTotal:\s*(\d+)/;
print "Max = $max\n";
my %values;

foreach my $name (qw(MemFree MemShared Buffers Cached))
 {
  my $lab = $mw->Label(-text => $name);
  my $pg  = $mw->ProgressBar(-fg => '#404080', '-length' => '3c', -width => '3m',
                 -to => $max, -variable => \$values{$name});
  Tk::grid($lab,$pg);
 }


newValue();
$mw->repeat(5000,\&newValue);

MainLoop;

sub newValue
{
 my $info = `cat /proc/meminfo`;
 foreach my $name (keys %values)
  {
   ($values{$name}) = $info =~ /$name:\s*(\d+)/;
   print "$name ",$values{$name},"\n";
  }
}