* Cinzia Sala <[EMAIL PROTECTED]> [2004-07-07T09:35:42] > I would like to transform a string like : > > MSDDIDWLHSRRGVCK > > in a identical string, but with two spaces between each letter: >
You wouldn't use tr/// for this. There are two simple ways: $string =~ s/(.)(?!\Z)/$1 /g; # replace any char /not/ followed by end-of-string with itself and a # space or $string = join(' ', split('', $string)); # split $string into individual characters # then rejoin them with two spaces between them consult "perldoc -f split" and "perldoc -f join" for the latter one. -- rjbs
pgpWAWiuSswoK.pgp
Description: PGP signature