#!/usr/bin/perl use strict; my @if_lines = `ifconfig`; foreach (@if_lines) { #you could remove interfaces with next if /^stf/; #this says if the line starts with stf, skip it. next unless (/up/i); #this says only print if the line has up (ignore case). print; }