BhariD has asked for the wisdom of the Perl Monks concerning the following question:
I have the following code to find the occurrence of first longest substring of 1's
my $string = '00111100110'; $string =~ m/(1{1,}1)/; print $string, "\t", $1, "\n";
If I want to replace that longest substring ($1) found with a different number lets say '2' in the original $string, i.e. '00222200110' instead of '00111100110', how should I do that?
|
|---|