Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: String replace

by davidrw (Prior)
on Nov 29, 2005 at 18:09 UTC ( [id://512737]=note: print w/replies, xml ) Need Help??


in reply to String replace

perhaps some variant on this?
my @random_names = qw /AAA BBBBB CCCCC DDDDDD/; $s =~ s/[A-Z]{3,}/$random_names[int rand $#random_names]/sg;
note: i assumed your products would be at least 3 characters and only have A-Z in them (i.e. no dash, underscore, numbers, etc).
Similarily, you could replace with a hash lookup if you want all of product NNNNN replaced with the same thing.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://512737]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found