Once you are done with this lab, you should be familiar with the following:
using Perl's primitive data structures such as arrays and hashes
executing external commands from a Perl script
parsing text using Perl's regular expression facility (regex)
All of you should have experiences on using search engines, like Google and Yahoo. In this assignment, you will write a Perl script that takes a keyword as an argument, creates a search query and searches it on both Yahoo and Google.
The script then takes the top 5 results from both search engine and display the URL and which search engine provide the result. The format of the output should be:
"http://www.tessa.org/" - Google & Yahoo "http://www.tessacs.org/" - Google & Yahoo "http://twitter.com/tessa" - Google "http://www.tessafrica.net/" - Google "http://tessasbraces.blogspot.com/" - Google "http://en.wikipedia.org/wiki/Tessa_No%C3%ABl" - Yahoo "http://www.tessahoran.com" - Yahoo "http://www.tessaradley.com" - Yahoo
You are required to use the UNIX command wget to download the webpages. Here is how the command works:
wget -U "Mozilla/5.0" -O "outputfile" "URL" > /dev/null
Example:
wget -U "Mozilla/5.0" -O "temp.html" "http://www.google.com" > /dev/null
Same like last time, except this time you're copying your Perl (.pl) file to the handin directory. Early is Saturday midnight, (+10% bonus), Sunday midnight is on time, Monday midnight is the end of the late period (-10% penalty).