The solution proposed with substr will work, but only if the preceding characters before www.google.com are always 10 characters long. If that is always the case, then substr will work well. If the character length preceding your URL is variable, may I suggest split and join?
$qname1 = join ".",(split(/\./, $string))[2,3,4];
The code will only work if there are exactly two dot separated strings prior to the url. If that, too, is variable, then perhaps you could try this small modification:
$qname1 = join ".",(split(/\./, $string))[-3,-2,-1];
Cheers,
Kristina