in reply to regex multiple times
$string='abchijk'; while ($string =~ s/(\w{2})(\w)/$1\|$2/) { print "$string\n"; } [download]