Help for this page

Select Code to Download


  1. or download this
      # prepare regex sub-expressions
      my $sizerx = '(-|\d+(\.\d+)?[GM]?)'; # Matches '-', or a float + 'M'
    + or 'G' for size
    ...
      ) {
        print "using regex, host is [$1]\n"; 
      }
    
  2. or download this
      my($host,$os,$nproc,$load,$memtot,$memuse,$swapto) = (
        $_ =~ /^(\w+)\s+    # host
    ...
      } else {
        next;
      }