On Thu, 29 Nov 2001, Dave O'Neill wrote:
> perl -p0 -e'1while s/.*?\n(.*\n).+\n?/$1/s;s/\n.*//'
> perl -p0 -e'1while s/.*?\n(.*\n).+\n?/$1/s;s/\n.*//' (Yanick)
> perl -p0 -e'$n=y|\n||>>1;s/(.*\n){$n}//;s/\n.*//s' (Andrew)
> perl -p0 -e'$n=1+y|\n||/2;/(.*\n){$n}/;$_=$+' (Yv2.0)
> perl -p0 -e'$n=1+y|\n||/2;($_)=/(.*\n){$n}/' (japhy)
> perl -0naF'\n' -e'print @F[@F>>1]' (dave0)
And, one character shorter and printing a scalar instead of an array
slice:
perl -0naF'\n' -e'print $F[@F/2]' (dave0 #2)
-dave0
--
aitchteeteepeecolonslashslashtripledoubleyoudotevilplotdotorgslashtildedave
"Not much call for a barbarian hairdresser, I expect. I mean, no-one
wants a shampoo-and-beheading" -- ``Sourcery'', Terry Pratchett