Extracting all URLs from a file

From datori.org, a useful one-line Perl command on how to extract all URLs from a file:

cat file.html | perl -n -e 'chomp;s/.*?(?:(?i)href)="([^"]+)".*?(?:$|(?=(?i)href))/$1\n/xg and print'