$fname = "../all"; open(TEXT, "<$fname")|| die "could not open file: $fname\n"; my @words =(); while () { $txt .= $_; } @words = split (/[ +\n+\,\:]/, $txt); $len = @words; print "LEN = $len\n"; close (TEXT);