my @raw_data = `ip link`; my @NIC = grep { /^\d+:\ /; } @raw_data; for (@NIC) { chomp; s/^[0-9]+:\ ([a-z]+[0-9]*):\ .*$/$1/; } Data::Dump::dd(@NIC);