> > You probably had $string double quoted instead of > single quoted which later results in the \ being eaten. >
Thank you. The people who said the problem of double quoted string are correct, I didn't know this item before. This is what I really want: use strict; my $email1 = restore_email_from_soa('support.dnsbed.com.'); my $email2 = restore_email_from_soa('dns\.support.dnsbed.com.'); my $email3 = restore_email_from_soa('dns\.tech\.support.dnsbed.com.'); print $email1,"\n"; print $email2,"\n"; print $email3,"\n"; sub restore_email_from_soa { my $email = shift; $email =~ s/\.$//; if ($email =~ /^(.*?)(?<!\\)\.(.*)$/) { my $user = $1; my $tld = $2; $user =~ s/\\//g; return $user . '@'. $tld; } } The output: supp...@dnsbed.com dns.supp...@dnsbed.com dns.tech.supp...@dnsbed.com Thanks a lot! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/