use strict; my $row1 = "newjersey-ab1.net agg nj1-dpta1 net 10"; $row1 =~ s/^.+\s+.+\s+(.+)-dpt.*$/\1/; print $row1;