in reply to regex multiple times

One way, with regexes, is:

$string =~ s/(..)/$1|/g;
If the string is read from a handle, there is a neat trick using a reference to an integer for $/:
my $string; { local $/ = \2; my @pairs = <FOO>; $string = join '|', @pairs; }
It would be good if one of the modules tieing handles to strings honored $/ accurately enough to us this on a string, but afaik they don't.

After Compline,
Zaxo