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