>-----Original Message-----
>From: Greg Bacon [mailto:[EMAIL PROTECTED]]
>
>Yesterday, I saw an interesting related exercise. Write a program that
>reads the lines from a file and outputs the middle
>line. The kicker is that you can't use arrays.
It's not really that much fun and it's a memory hog, but it seems to work on
all data I've passed to it, runs in O(n) time, and doesn't have any arrays.
#!perl -w
open FILE, $ARGV[0] or die;
my %filecontents;
my $i = 0;
while (<FILE>) {
$filecontents{$i++} = $_;
}
print $filecontents{int($i/2)};
Dancin Santa
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp