my $test = "10 1/0/6/0/0.1.20.0.0.2.1 c10t2d1 FA "; my ($ctd) = $test =~ m/(\w+)\s+FA\s*$/; print $ctd; #prints: c10t2d1