On Thu, Nov 29, 2001 at 07:09:10AM -0600, Greg Bacon wrote:
> 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.  (Note that there's a little ambiguity with
> respect to the definition of "middle line" when the number of lines in
> the file is even or when there is only one line.  Just pick a reasonable
> definition and get to work.)

 From the ludicrous department:

        perl -p0 -e'1while s/.*?\n(.*\n).+\n?/$1/s;s/\n.*//'


Joy,
Yanick

-- 
print join ' ', reverse split ' ', reverse join ' ', 
q/teY rehtona lreP .rekcah/;
            • ... abigail
              • ... Michael G Schwern
          • ... Uri Guttman
          • ... abigail
      • ... Uri Guttman
        • ... Michael G Schwern
          • ... Uri Guttman
      • ... Ariel Scolnicov
      • ... abigail
  • ... Ian Phillipps
  • ... Yanick
  • ... Greg Bacon
    • ... Michael G Schwern
      • ... Dmitry Kohmanyuk Дмитрий Кохманюк
        • ... Greg Bacon
          • ... ianb
          • ... Ian Phillipps
            • ... Jonathan E. Paton
              • ... Greg Bacon
              • ... Jonathan E. Paton
              • ... Jonathan E. Paton

Reply via email to