Parsing a url in perl?

jdr0317

New member
I'm working on trying to remove all subdomains from urls.

Example, I have a list of url's that may look like this:

nfl.com
mlb.com
apple.com
football.blogspot.com
forums.somesite.com
facebook.com
twitter.com


I need to know how I can write a regular expression in perl so that I can print just the domain of the website (ex: blogspot.com, not football.blogspot.com). Any simple way to do this?
 
Back
Top