#!/usr/bin/perl -w ################################ use strict; open(PIPE,'netstat -i|') or die $!; my $header=; # Kernel Interface Table $header=; # The real header chomp $header; # # Oh... what the hey... Let's parse it just for grins. my @fields=split(/[\s]+/,$header); my %ifTable=(); # Set up an empty assoc array while (my $line=){ chomp $line; my @f=split(/[\s]+/,$line); foreach my $ix(1..$#f){ $ifTable{$f[0]}->{$fields[$ix]}=$f[$ix]; } } # # But wait... you just wanted the IF names: printf "%s\n",join(",",keys %ifTable); #### vmnet1,lo,wlan0,vmnet8,eth0 #### : : much handwaving here my @results=grep /eth1/,`netstat -i`; : : I didn't test that, but should work... : #### : : print "It's there\n" if $ifTable{'eth1'}; # or whatever : :