use strict; my $str = "Element1 Element2 Element3 Element4 Element5 Element6"; my $nth = @{[$str =~ m/\w+/g]}[3]; print "$nth\n"; #### Element4