in reply to can u suggest a regex for this ?
Scalar without /r
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11150123 use warnings; my $blockoftext = <<END; mouse cat 1 2 3 ^cat deer eel cat furbaby elk ^cat dog fish END $blockoftext =~ s/^cat.*?^\^cat/ my $catsection = $&; $catsection =~ s!^!#!gm; $catsection /gems; print $blockoftext;
|
|---|