File indexing completed on 2024-09-08 03:28:58
0001 #!/usr/bin/perl 0002 0003 use strict; 0004 0005 my $max_len = 0; 0006 my $max_line; 0007 my $max_file; 0008 0009 for my $file (@ARGV) { 0010 open(FILE, $file) or do { 0011 warn "Couldn't open($file) $!\n"; 0012 next; 0013 }; 0014 while (<FILE>) { 0015 my $len = length($_); 0016 $len > $max_len or next; 0017 $max_len = $len; 0018 $max_file = $file; 0019 $max_line = $.; 0020 } 0021 } 0022 0023 print "Max length: $max_len found on line $max_line in file: $max_file\n"; 0024