#!/usr/bin/env perl use strict; use warnings; while ( ) { next if /^HOSTNAME/; # skip title line next if /^\-/; # skip lines which start with "-" s/^\s+//; # remove whitespace at start of line s/\s+$//; # remove whitespace at end of line next if /^$/; # skip blank lines my ($host, $arch, $proc, $load, $memtot, $memuse, $swap, $swapuse ) = split; print "Using split function Host is $host\n"; } __DATA__ HOSTNAME ARCH NPROC LOAD MEMTOT MEMUSE SWAPTO SWAPUS ------------------------------------------------------------------------------- global - - - - - - - Luke glinux 2 0.70 3.4G 919.5M 1.9G 681.6M bobafett glinux 2 0.00 3.4G 205.8M 1.9G 0.0 bones glinux 2 0.01 2.0G 150.9M 1.9G 0.0 c3p0 glinux 2 0.37 3.4G 101.6M 1.9G 7.2M dax glinux 4 0.81 2.0G 438.0M 1.9G 272.1M geordi glinux 4 - 2.0G - 1.9G - han glinux 2 0.53 3.4G 373.6M 1.9G 243.3M janeway glinux 2 0.00 7.3G 351.9M 16.0G 0.0 lando glinux 4 1.27 7.3G 445.8M 1.9G 6.9M sisko glinux 2 - 2.0G - 1.9G - sulu glinux 2 - 493.7M - 1019.7M -