in reply to Count the number of lines in a file
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.
|
|---|