in reply to How can i get a substring from a String?

Use Regex.
$qname="_sip._udp.www.google.com"; $qname =~ m/(_sip\._udp\.)(.*)/; $qname1 = $2;
If you want to replace string "_sip._udp." from the variable, you can use the following code.
$qname="_sip._udp.www.google.com"; $qname =~ s/(_sip\._udp\.)(.*)/$2/;