http://qs321.pair.com?node_id=514445


in reply to search and replace from array values

hmm,

@search = ("red", "orange", "blue"); @replace = ("yellow", "black", "green"); $text = "my pig is red, my orange is orange and the sky is blue"; foreach (0..$#search) { $text =~ s/$search[$_]/$replace[$_]/; } print $text,"\n" __END__ my pig is yellow, my black is orange and the sky is green
To replace every ocasion in text, use the g-modifier (s///g)

not a beauty, but works...

regards,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus