Your @{[$str =~ m/\w+/g]}[3] would be better written as ($str =~ m/\w+/g)[3]. I'd more likely write it as, my $nth = (split ' ', $str)[3]; though that's not exactly the same thing with respect to punctuation, etc. Whether that is as usable to you depends on your data.
After Compline,
Zaxo
In reply to Re: Capturing the nth word in a string
by Zaxo
in thread Capturing the nth word in a string
by Roger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |