Dear list,
After everyone clogging up my mailbox, I thought I should
be entitled to do the same. Here's my suggestion,
apologies if I've just accidentally reinvented someone
else's idea...
Note I've made it work from a pipe, since I can't be
bothered with open and close. I've discarded unneeded
lines, and also hope everything fits within the problem
definition - appears to.
--- START PERL SCRIPT ---
#!/usr/bin/perl -w
$j++;
while (<>) {
$line{$.} = $_;
delete $line{$j++} if ($. == 2 * $j);
}
print $line{$j};
--- END PERL SCRIPT ---
Variations on this theme appear to be the only solution,
since a stream could end at any time - requiring backing up
to the middle string found. In fact, I'm sure must have
thought of this, but who?
Jonathan Paton
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music
Charts
http://uk.my.yahoo.com