Perl

Created Saturday 26 April 2014

use File::Find;
my @files;

find(
sub {
push @files, $File::Find::name
if -f $File::Find::name && /\.pm$/
},

@INC
);

print join "\n", @files;
open(FILE, "<file.txt") or die "Could not open file: $!";

my ($lines, $words, $chars) = (0,0,0);

while (<FILE>) {
$lines++;
$chars += length($_);
$words += scalar(split(/\s+/, $_));
}

print("lines=$lines words=$words chars=$chars\n");



Backlinks: