#!/usr/bin/perl use strict; my @files = ; for my $file (@files) { my count = 0; open(MYFILE,"<",$file) or do { warn "Failed to open file: $file:$!\n"; next}; while() { $count++; } print "$file has $count lines\n"; }