Hi Paul,
I'm not entirely sure of what you mean by "isolating" a word, but Perl programmers often use regular expressions to locate and manipulate words. You can look at 'perldoc perlre' for more info on regular expressions and 'perldoc perllocale' for information on making the regular expression's "words" more sensitive to non-US character sets. Maybe this script does more or less what you're looking for:
#!/usr/bin/perl use strict; use warnings;
while ( <DATA> ) { s!(\w*a+\w*)!<word>$1</word>!g; # words with 'a' in them print; }
__DATA__
I am trying to write a script to identify all words having a certain pattern in a text file. Is there in Perl a direct way of isolating a word with a certain pattern? Or has one to check all characters, bearing in mind that a word is a string delimited by two spaces?
Output:
I <word>am</word> trying to write <word>a</word> script to identify <word>all</word> words <word>having</word> <word>a</word> <word>certain</word> <word>pattern</word> in <word>a</word> text file. Is there in Perl <word>a</word> direct <word>way</word> of <word>isolating</word> <word>a</word> word with <word>a</word> <word>certain</word> <word>pattern</word>? Or <word>has</word> one to check <word>all</word> <word>characters</word>, <word>bearing</word> in mind <word>that</word> <word>a</word> word is <word>a</word> string delimited by two <word>spaces</word>?
Best,
Damon
-- Damon Allen Davison http://www.allolex.net
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>