Mon Feb 17 21:43:24 GMT 2003

February 17, 2003

Behold, my first perl program:

#!/usr/bin/perl -w
use strict;

my @lines = (); my $lines = 10;

while (my $line = <STDIN>) {   push(@lines, $line);   if ($lines-- < 0) {     shift(@lines);   } } print @lines; 

It is basically a dirt-simple and feature-lacking implementation of the standard unix-utility “tail”. But fun nonetheless. Ah well. Back to doing useful stuff…

Leave a Reply