http://qs321.pair.com?node_id=105810


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