Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How can I write this in a "simpler" way?

by thezip (Vicar)
on Feb 12, 2014 at 00:15 UTC ( #1074555=note: print w/ replies, xml ) Need Help??


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...


Comment on Re: How can I write this in a "simpler" way?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1074555]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-09-23 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (242 votes), past polls