The most likely explanation for why "do something for each line of file x" would do nothing is that there are no lines in file x, right? That is, it will do something three times for a three-line file, and zero times for a zero-line file, or a file that doesn't exist. It's not failing, it's doing what it's told to do.
So where is history.txt, and what does it contain? Is it in the same folder as countwords.pl for a start?
jh
On 26/12/2004, at 2:44 PM, Lola Lee wrote:
I'm taking a Perl class and and I'm working on comprehending this script in one of the lessons. This script has you count words in a file. The line where one is supposed to read in the file being counted is like so:
while (defined($line = <>))
However, when I type this in: perl countwords.pl history.txt
Nothing happens. This lesson that I'm working on is working from the premise that people are using a Windows Perl installation. So it looks like I need to change the line above so that it will work in my setup. What would be a good way to change this line?
-- Lola - mailto:[EMAIL PROTECTED] http://www.lolajl.net | Blog at http://www.lolajl.net/blog/ Terrorism delenda est! (Terrorism must be destroyed utterly!) I'm in Bowie, MD, USA, halfway between DC and Annapolis.