Ramprasad A Padmanabhan wrote:
Hi,

Hello,

  I want to run a substitution for all instances of "_" with "." after
'@' in a string but "_" before "@" should not be touched.

eg $str = "[EMAIL PROTECTED]";

Should become

[EMAIL PROTECTED]

$ perl -le' my $str = q/[EMAIL PROTECTED]/; $str =~ s/([EMAIL PROTECTED])/($a = $1) =~ tr|_|.|; $a/e; print $str; ' [EMAIL PROTECTED]


$ perl -le' my $str = q/[EMAIL PROTECTED]/; substr( $str, index $str, q/@/ ) =~ tr/_/./; print $str; ' [EMAIL PROTECTED]




John -- use Perl; program fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to