Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: reading files

by greengaroo (Hermit)
on Oct 31, 2012 at 14:45 UTC ( #1001677=note: print w/replies, xml ) Need Help??

in reply to reading files

That would be the easiest Pure-Perl way of doing it:

open(FILE,"/path/to/file.txt") or die "could not open file: $!"; my @_lines = <FILE>; # After I open the file for reading close(FILE); if ( scalar(@_lines) >= 100 ) { shift( @_lines ) for ( 0 .. (scalar(@_lines) - 100) ); # shift removes the first element of the list # but what if you had 110 lines? you have to loop # and you start the loop at 0 because if you have 100 lines # 100 - 100 = 0 and 0 .. 0 will give you one iteration # but 1 .. 0 would not loop at all # then you overwrite the file open(FILE,">/path/to/file.txt") or die "could not open file: $!"; print FILE @_lines; close FILE; }

There are no stupid questions, but there are a lot of inquisitive idiots.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001677]
[thezip]: So, we have a small deployment coming up soon for a project. What is the general name for the project management documentation that details the tasks and schedules/ sequences for the execution of the deployment?
[thezip]: Deployment checklist?
[Corion]: thezip: Yeah - we have "CAP", but that means "Change Ablauf Plan" (Change Sequence Plan). Likely there is a true ITIL name for this too.
[Corion]: While I'm not really a fan of ITIL, it certainly is better than nothing and it at least provides a common vocabulary, so if you have ITIL somewhere at your disposal, it might be worth a look

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-02-23 17:50 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (350 votes). Check out past polls.