Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Find last line in Text file parsing

by vsailas (Beadle)
on Oct 04, 2010 at 06:42 UTC ( [id://863271]=note: print w/replies, xml ) Need Help??


in reply to Find last line in Text file parsing

Its right you do not have to open file twice. If the files are small... you can always place file contents in and array and use them.

open(FILE, "< nanotest.txt") || "can't open $file: $!"; my @arr = <FILE>; my $last = $#arr+1; ## you can also use $. instead of $#arr my $count; foreach (@arr) { $count++; if ($count == $last) { # Validate last line } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-23 17:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found