1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #!/usr/bin/perl
use Switch;
use File::Copy;
use strict;
open( PIPE,'netstat -i|' ) or die $!;
my $header=<PIPE>; # Ignore the column headers for the Kernel Interface Table
my @tokens;
while (my $line=<PIPE>)
{
chomp $line;
print "$line \n";
@tokens = split( " " , $line ) ;
foreach my $val ( @tokens )
{
print "$val\n";
last;
}
}
close( PIPE );
# http://perlmeme.org/howtos/perlfunc/split_function.html
# push() - adds an element to the end of an array.
# unshift() - adds an element to the beginning of an array.
# pop() - removes the last element of an array.
# shift() - removes the first element of an array.
|