Despite the danger in making assumptions, on a guess that you mean how does one extract names from a text document which contains names and other words, you may find some benefit from the following:
a. Create an array with the names you want to extract (perl can do most anything, but washing windows and differentiating between names and other words are out of scope. See Tutorials)
b. Slurp or read line-by-line (depending on the size of the document) the text file. open and, again, the tuts here.
c. Test (see perlre, perlretut, et al_, word-by-word (for values of word meaning preceded or followed by a space, punctuation or EOL) in the line or file for matching against any of your array elements (names).
If reading line-by-line, rinse and repeat.d. Capture the words that match names (see Tuts, the regex docs, etc) -- probably to an array with something like push @names_found, $name.
e. Do something with the array.
And, in deference to the values of the Monastery and those from whom you ask help, you might wish to read some of the documents that lay out what are considered "good practices" here at PerlMonks I know what I mean. Why don't you?, On asking for help and How do I post a question effectively?.
In reply to Re: Extract names
by ww
in thread Extract names
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |