#!/usr/local/bin/perl -w use strict; my $ifconfig = `/usr/etc/ifconfig ec0`; my ($junk, $ip_address) = ($ifconfig =~ /(^.*\n.*inet\w)(d{1,3}\.\d{1,3}.\d{1,3})/); print "$junk $ip_address\n";