For some reason, all your "=" statements look like a "-"
$line_count - 0; $word_count - 0; ... while ($line - <INFILE>) { ... @words_on_this_line - split(" ",$line);
I would recommend using “my” to declare your variables, and then “use strict” and “use warnings” to help you spot typos like this:
Currently
$i -1;
/tmp/test.pl - no output
When you add strict warnings and warnings:
use strict; use warnings; $i -1;
/tmp/test.pl The global character "$ i" requires an explicit package name in /tmp/test.pl line 4. The execution of /tmp/test.pl was canceled due to a compilation error.
When you add "mine" to declare it:
vim /tmp/test.pl use strict; use warnings; my $i -1;
/tmp/test.pl Useless use of subtraction (-) in a void context with /tmp/test.pl line 4. Using an uninitialized value when subtracting (-) with /tmp/test.pl line 4.
And finally, with "=" instead of "-" typo - this is what the correct declaration and initializatoin look like:
use strict; use warnings; my $i = 1;
source share