Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

(elbie 2): Last two rows or a csv file.

by elbie (Deacon)
on Aug 18, 2001 at 02:09 UTC ( #105810=note: print w/ replies, xml ) Need Help??


in reply to Re: (elbie): Last two rows or a csv file.
in thread Last two rows or a csv file.

If you don't need to store the contents of the file, try this:

open (FILE, "edidocs.csv") or die "Can't open file $!\n"; my( $curr_time, $prev_time ); # Sorry about the $ in the original while( <FILE> ) { $prev_time = $curr_time; $curr_time = ( split /,/ )[1]; }

If you do need to store the whole file, then the last two lines are stored in $lines( $#lines - 1 ) and $lines( $#lines ) of your example before you popped them off the stack.

elbieelbieelbie


Comment on (elbie 2): Last two rows or a csv file.
Select or Download Code
Replies are listed 'Best First'.
Re: (elbie 2): Last two rows or a csv file.
by qball (Beadle) on Aug 18, 2001 at 02:28 UTC
    Great! This works beautifully. Now I'm onto another stumbling block. How would I get the same percentage calculation for the entire month using the epoch timestamp in the csv file?

    qball~"I have node idea?!"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (17)
As of 2015-07-28 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (256 votes), past polls