#!/usr/bin/perl -w use strict; $_ = 'childhe.com/pas/ apstpldr.dll.html? affid=177194&uid=& guid=4E83C7975FCD4 4B091226646F461D89 1/pas/apstpldr.dll .html?affid=177194 &uid=&guid= 4E83C7975FCD44B091 226646F461D89'; s/\?.*?(?=\/|$)//g; print;