http://www.perlmonks.org?node_id=1038877

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

Hi Monks, Is there any way to speed up the substitution.

while ( index($group, "!") > -1 and $index<50000 ) { $group =~ s/!/\n/; index++; }
The above replace line is in loop which executes 50,000 times and replace the '!' symbol everytime. So it takes around 10 mins and also the input string is so large. Thanks in advance.