scalar $link =~ /\G\Q$match/g or last;
$trim++;
}
# truncate link upto where the earlier value starts to differ
if ($trim < length $link) {
substr($link, $trim) = '';
scalar $link =~ /\G\Q$match/g or last;
$trim++;
}
# truncate link upto where the earlier value starts to differ
if ($trim < length $link) {
substr($link, $trim) = '';