bazz
05-03-2010, 12:28 PM
Hi,
I ahve a section of text like this
The quick brown fox jumps over the lazy dog.
My array is like this
@array = 'brown','lazy';
My attempt is to use grep but I think I am trying to use the wrong structure.
my @text = $text;
foreach my word (@text){
if (grep $word, @text){
do this;
} else {
do that;
}
}
Should I put the text into an array and grep on each of its words to try to match the @array?
bazz
I ahve a section of text like this
The quick brown fox jumps over the lazy dog.
My array is like this
@array = 'brown','lazy';
My attempt is to use grep but I think I am trying to use the wrong structure.
my @text = $text;
foreach my word (@text){
if (grep $word, @text){
do this;
} else {
do that;
}
}
Should I put the text into an array and grep on each of its words to try to match the @array?
bazz