# assuming it's tabs; change "\t" to "\s" or "\s+" as appropriate my ($router, $cache, $tmp, $as, $sample) = split ("\t", $line); my $host = (split "-", $tmp)[0]; # grab LHS of $tmp $host =~ tr/0-9//d; # strip any digits -- whether this is right # REALLY depends on your data