Hi Prateekm, Hope you must have been benefited by other replies to your query. I was just going through the various responses to your query I tried the one suggested by one of our friends It works well for first eg in the query but fails in case of second query. It won't even compile if you "use strict". I can think of only two options First do not "use strict" during compilation. Second escape the $ symbols in the string $url. Above all are you absolutely sure that you have spotted such a url which carries $symbols. The url you have mentioned took me to some USA.com In that site I tried a few links like "hotel reservation", "Car rental", "Airline reservation" but at least in these three cases I could not spot a $ in the url address. You see the $ is a reserved symbol in PERL and that is the reason that $ is not acceptable in the variable $url during compilation. Also I may add that if you are working on a large number of cases(URLs) then the ".com" loses its significance In that case a better approach will be to combine the two suggestions made by our friends i.e. first split at "\" and then again explode it into an array at the dot character. Now you can just discard the "com". In my example code I have escaped all the $. There might me a better solution because of "TMTOWDI" #!/usr/bin/perl use strict; use warnings;

In your example script there is no need to escape the $ in order to compile under strictures. All that's needed is to use the proper quoting, which you did not do.

The general rule that I follow is to only use double quotes or the qq() operator when you need variable interpolation, otherwise just use single quotes or the q() operator.

Using split as has already been suggested may be the easiest for the given example url's but it's not the best method. For a more robust solution, I'd recommend (as did ichi) using one of the modules written for this purpose, such as one of the URI modules. http://search.cpan.org/~gaas/URI-1.37/URI.pm

Yes if one uses single quotes or a q() instead of double quotes There is no need of escaping the dollar symbol when used under strictures. (I was wrong that it is not compiling because a dollar is reserved to signify a scalar in perl). I will be more careful in future. Even then I have never seen a dollar sign in a url. May be next time I will try to stare a bit harder on the url address bar. SPlit is the easiest way to do that is why I twice used split. Use it once more to throw out the .com. As for the module is concerned a "use so and so module" is definitely the simplest and most secure way to do things. Even though I have not checked the said module. -For all my suggestions " I am sure someone else can do it in a better or elegant manner!"