#!/usr/bin/perl -w use strict; my $ip_address; open (NETSTAT,"/usr/bin/netstat -in |") or die "Unable to execute netstat"; while () { next unless (/^ec0/); my @fields = split; $ip_address = $fields[3]; } print "$ip_address\n";