-->process file1 file2 file3 #### -->ls file* | process #### #!/usr/bin/perl use strict; use warnings; my $numargs = $#ARGV + 1; if ( $numargs == 0 ) { print "Incorrect number or arguments($numargs)...\nFormat: lines \n\n"; exit(0); } my $t = 0; for my $f ( 0 .. $#ARGV ) { my $file = $ARGV[$f]; open FILE, "<$file" or die "Could not open file, $file : $!\n"; my $c = 0; while () { $c++; $t++; } close (FILE); print "$c\n"; } print "----\n$t\n";