
(Photo by Dannels)
1. Some basics
Stock data can be download using the interface from Yahoo. But a quicker way is to access the stock data directly using web URLs. Typing the following in your web browser and you will be prompted to download a CSV file containing historical price data for Apple Inc. (and a few other things).
http://ichart.finance.yahoo.com/table.csv?s=AAPL
To get other companies, you will need to replace AAPL with the stock ticker you want. For Microsoft, it would be MSFT.
2. From Firefox to Excel
In Firefox, create a new bookmark, and input the following information:

The location text box should contain the following, which replaces AAPL with %s.
http://ichart.finance.yahoo.com/table.csv?s=%s
After you save the changes, you can now enter the following in the URL box to get the historical apple inc prices.
yfh AAPL
Pictorially,

When you hit enter, you should have something similar to the following. Firefox replaces your string with the one needed to get the historical data.

Open the files, and the historical data of Apple Inc. is now available for data analysis.
3. Other Possibilities
Using the same idea, you can also write Perl scripts to get the data for multiple companies for analysis. For example, I wrote a script to download a list of stocks and calculate moving averages. Alternatively, you can do the same thing with a bit of VBA for Excel.