in reply to SOLVED Removing characters

To expand on what moritz originally said, you should replace

$mystring = $mystring += $_=~ tr/ ,\.\t\n//;
with

$mystring .= $_=~ tr/ ,\.\t\n//;
What the ".=" operator says is "concatenate whatever follows on the right to the end of whever is specified to the left".

Revised:This is not an attempt to solve the original problem. moritz pointed out that "+" was not the concatenation operator, "." was. I tried to expand on this by showing that ".=" was more efficient still (from a Golfers perspective).

Replies are listed 'Best First'.
Re^2: Removing characters
by olus (Curate) on Jan 22, 2008 at 16:08 UTC
    Actually, that wouldn't solve the problem.
    Using tr was a good suggestion when Slug wanted to count the characters, but in this case he just wants to eliminate them.
    From the documentation

    If the REPLACEMENTLIST is empty, the SEARCHLIST is replicated. This latter is useful for counting characters in a class or for squashing character sequences in a class.

    So nothing would be replaced.

    You are right, of course, on the '.=' operator.