You can call this script with the files as standard input and standard output.#!/bin/perl use strict; use warnings; my $chars = 0; my $lines = 0; while (<>) { $chars += length; $lines ++; } print "$chars $lines\n";
If you want to open the files within the Perl script instead use the open() function.
In reply to Re: Count the number of lines in a file
by nobull
in thread Count the number of lines in a file
by pastorizah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |