use the word boundary operator \b
Code:
my $str = 'this is my test document and was created in perl and it is very goodis';
$str =~ s/\bis|was\b/are/ig;
print $str;
or you could try and use spaces:
Code:
my $str = 'this is my test document and was created in perl and it is very goodis';
$str =~ s/\sis|was\s/are/ig;
print $str;
but the \b operator is generally used for this type of substitution. Any regexp resource or tutorial should have it listed.