in reply to replacing strings using reg exp
There are a couple of errors in your code:
For your examples this line equates to
if( 'abcd<Utly>' =~ /\s*<Ut\s*>/)
There is no way that \s* will ever match 'ly'.
Even if the match was made, this line is saying: Look in 'abcd<Utly>' for 'Ut' and if you find it replace 'Ut' with 'Ut', which probably isn't what you want:)
If your arrays are of any size, your nested loops comparing every element of one array with every element of the second is going to take a quite a long while to run...if they're small then that probably doesn't matter, but you could make the process more efficient by using a hash, but it's probably better to get this one working before you move on.
|
|---|