in reply to modify variable on pass by value

#!/usr/local/bin/perl my $string = 'Hello, World ,,, my World 1984'; $string =~ s/\b\w//g; print $string;
there are my two cents

Replies are listed 'Best First'.
RE: RE: modify variable on pass by value
by xjar (Pilgrim) on Sep 11, 2000 at 21:20 UTC
    Just thought I'd post that this code actually strips the first letter/number of each "word" (but not the first comma) rather than just the capital letters (also stripped the newlines I added to the end of the string as well). Sadly, I do not have much knowledge in the way of regexps, so I can't add any insight into making this do exactly what the poster wanted, but the code from cianoz above worked great.
      so, you'd suggest we end up with a version near to merlyns proposal
      =~ s/\b([A-Z])//g;
      but chop doesn't care if it's a number and would even remove escape charcters completly if at the end of that string.