Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: script not working

by CountZero (Bishop)
on Dec 27, 2012 at 19:03 UTC ( #1010562=note: print w/ replies, xml ) Need Help??


in reply to script not working

Putting the whole file into an array is wasteful of time and memory. What will happen if it is a 10 GB file?

You can do just as easy the following:

use Modern::Perl; use autodie; open my $file1, '<', './file1.txt'; <$file1>; my $secondline = <$file1>; my $fivefirstfile1= substr($secondline, 0, 5);
It is faster and uses less memory.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics


Comment on Re: script not working
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-07-31 23:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (255 votes), past polls