web blazonry web development scripts and tutorials HTC One 4G Android Phone, Black Get best price
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   

Perl Home

Perl Scripts
  Count Links
  Mail to MySQL
  ProcLog Files
  Search and Replace
  Site Monitor
  UnTabify

Perl Articles
  csv2htm Converter
  OLE Automation
  Regular Expressions
  SubDir Recursion

Perl Resources
  Regular Expressions Quick Reference
  Regular Expressions Examples
  Recommended Sites
  Bestselling Perl Books
  Free Perl Books (new)
  Free Python Books(new)

Bookmark and Share




Perl: Count Number of Links On a Page

This perl script counts the number of links on a page. For a list of webpages, it also calculates the average number of links per page.

It is rather simple. It fetches a web page and parses it for links, counting them as it goes.

I wrote it for my own amusement. When I was first creating web pages, you kept the pages simple. The rule-of-thumb was to keep the choices a user had to make under seven. Put simply, we tried to limit the number of links on a page, not neccesarily to just seven, because you would have navigation links. However, we attempted to keep it simple to navigate and actually find something on the page.

The major web sites have gotten pretty crazy with how much crap they have crammed onto their pages. So, I wrote a script to count how many links the major sites have on their homepages. I provides interesting comparisons.

Results were generated on Dec-06,1998

URL# of Links
http://www.etrade.com/ 42
http://www.yahoo.com/ 135
http://www.excite.com/ 158
http://www.lycos.com/ 118
http://www.aol.com/ 128
http://www.zdnet.com/ 197
http://www.cnet.com/ 114
http://www.altavista.com/ 63
http://www.netscape.com/ 138
http://www.microsoft.com/ 58
http://www.apple.com/ 43
http://www.cnn.com/ 232
http://www.geocities.com/ 68
http://www.theglobe.com/ 103
http://www.scripting.com/ 95
http://espn.sportszone.com/ 94
http://www.sportsline.com/ 99
 
Average Links per Page 110.88


I wrote the script using Perl for Win32 and the Win32::Internet module, which is a module which allows you to fetch URLs using HTTP, FTP and GOPHER. Download and info on the Win32::Internet module

View linkCount.pl Script Source


Related Links:

Perl Networking FAQ

Perl for Win32

dada's perl lab - Win32 Modules

 

Newest Pages
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2013. astonishinc.com   All Rights Reserved.