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

stevee has asked for the wisdom of the Perl Monks concerning the following question:

Hello Venerable Monks
I have a number of flat text files (500). The text contains narrative which may contain product names (zero, one or more in each narrative), set IN CAPITALS quite helpfully. I would like to anonymise the data a little and replace the current product names with random other names. I have a randomised array of product names which contains far more names than I can use. My question is, is there a shortcut to this through regular expressions or some other means?

As an example:
"The respondent uses the following products XXX, YYYYYYYYY, ZZZZZZZ around the house and they are considering using QQQQQQQ too. They are particularly impressed with ZZZZZZZ."

Which I would like to change to

"The respondent uses the following products AAA, BBBBBB, CCCCCC around the house and they are considering using DDDDDDDD too. They are particularly impressed with CCCCCC."

Any help would be really appreciated as I am slowly getting up to speed with PERL but not fast enough!
Thanks in advance,
Stevee