Archive of UserLand's first discussion group, started October 5, 1998.

Re: tail -f in a web page

Author:Aaron Straup Cope
Posted:11/6/1999; 3:02:04 PM
Topic:A question for Apache gurus
Msg #:12780 (In response to 12764)
Prev/Next:12779 / 12781

The Perl Cookbook Chapter 8.4 , Reading a File Backwards by Line or Paragraph

#!/usr/local/bin/perl

use strict;

my $i = 0; my $j = 3;

my @lines =

while ($line = pop @lines) { ($i == $j) ? last : $i++; # do something with line; }

Alternately, you just could just take a slice from the bottom of the array and loop over that...

btw : what's the deal with new lines. everybody has nicely formatted code but me :-(




This page was archived on 6/13/2001; 4:53:22 PM.

© Copyright 1998-2001 UserLand Software, Inc.