buggy
09-30-2004, 04:41 PM
I have an array of elements, most of which are fine to print to a file. I have a list of words (life,death,ireland,professional,sector) and when one of these words occurs I dont want it to be printed but if one of the words appears as part of a phrase all is fine. I mean 'my professional world' should be allowed.
my array of elements is : myarray;
At the moment I am trying;
foreach $ele (@myarray){
if(grep /life|death|ireland|professional|sector/i,$ele){
#we dont want these
}
else
{
print $ele,"\n";
}
}
The original list (life,death,ireland,professional,sector) is blocked correctly but 'my professional world' is also blocked which I dont want.
I only want to stop exact matches of each word.
Any help would be great.
my array of elements is : myarray;
At the moment I am trying;
foreach $ele (@myarray){
if(grep /life|death|ireland|professional|sector/i,$ele){
#we dont want these
}
else
{
print $ele,"\n";
}
}
The original list (life,death,ireland,professional,sector) is blocked correctly but 'my professional world' is also blocked which I dont want.
I only want to stop exact matches of each word.
Any help would be great.