sub nthword { my ($texttomatch, $fieldnum) = @_; ($texttomatch =~ m/\s*(\S+)\s*(\S+)\s*(\S+)\s*(\S+)\s*/)[$fieldnum]; }