....snip open (CONFIG, $config_file) || die "Cannot open $config_file:$!\n"; while (my $line = ) { chomp $line; next if ($line =~ /^\#/); my ($router, $cache, $tmp, $as, $sample) = split (' ', $line); if ($tmp =~ /(\w+)(.*)\-(.*)dta/) { my $host = $1; print "$host\n"; } }