in reply to regex multiple times
One way, with regexes, is:
If the string is read from a handle, there is a neat trick using a reference to an integer for $/:$string =~ s/(..)/$1|/g;
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.my $string; { local $/ = \2; my @pairs = <FOO>; $string = join '|', @pairs; }
After Compline,
Zaxo
|
|---|