in reply to How can I write this in a "simpler" way?
YAWTDI...
#!/usr/bin/perl use strict; use warnings; use Tie::File; my $filename = 'data.txt'; tie(my @array, 'Tie::File', $filename) or die "Could not open $filenam +e for reading"; my $total_lines = 0; for (@array) { chomp; $total_lines += $_; } printf "There are %d lines in %s\n", $total_lines, $filename;
*My* tenacity goes to eleven...
In Section
Seekers of Perl Wisdom