in reply to Re^2: How can I count characters between two same substrings in a string where the substring is repeated more than 5 times?
in thread How can I count characters between two same substrings in a string where the substring is repeated more than 5 times?
Untested:
my @chunks = split /PAT/, $str; shift @chunks unless $str =~ /^PAT/; pop @chunks unless $str =~ /PAT$/; if (@chunks > 4) { say "Lengths: @{[map {length} @chunks]}"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How can I count characters between two same substrings in a string where the substring is repeated more than 5 times?
by aaron_baugher (Curate) on Dec 09, 2011 at 16:52 UTC |