in reply to How do I just count any words from a file?

Cazbo,
If you are familiar with the unix command wc, it sounds like you are trying to re-implement that. If you are not doing this as a "learning" exercise, I would recommend you use an existing wheel (see PPT for instance). If you are just trying to do this yourself, here is something that should get you started:
#!/usr/bin/perl use strict; use warnings; my $file = $ARGV[0] or die "Usage: $0 <input_file>"; open(my $fh, '<', $file) or die "Unable to open '$file' for reading: $ +!"; my ($line_cnt, $word_cnt, $char_cnt); while (<$fh>) { chomp; $line_cnt++; $char_cnt += length($_); my @word = split " ", $_; $word_cnt += @word; }

Cheers - L~R