http://www.perlmonks.org/?node_id=437032
Someone has enquired about the true identity of Ton Hospel
and I didn't really know how to answer.
/-\
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com
Nice. Perhaps it'll prompt a new compo soon :)
--
Jasper
> Nice. Perhaps it'll prompt a new compo soon :)
Ahhh .. how I long for the good old days.
Speaking of that, there was a post yesterday on
comp.lang.perl.misc asking about a one-liner to
reverse the lines in a file in-place. So the input
file itself must be modified and no other files must
be created.
I came up with this:
perl -aF"\n" -lp0 -i -e '$_=join$\,reverse@F' in.file
But then, I remembered Eugene's (in)famous solution to
reverse sort, but couldn't get it to work:
perl -pi -e '$x=$_.$x}{$_=$x' in.file
This prints to screen, not back to the file.
Any takers?
--Ala
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
perl -i -ne 'unshift@_,$_;eof&&print@_' in.file
>-------- Оригинално писмо --------
>От: Eirik Berg Hanssen <Eirik-Ber...@allverden.no>
>Относно: Re: Perl golf article at Perl Monks
>До: Ala Qumsieh <ala_q...@yahoo.com>
>Изпратено на: Четвъвтък, 2005, Март 10 20:40:18 EET
>----------------------------------
>
>Ala Qumsieh <ala_q...@yahoo.com> writes:
>
>> I came up with this:
>> perl -aF"\n" -lp0 -i -e '$_=join$\,reverse@F' in.file
>>
>> But then, I remembered Eugene's (in)famous solution to
>> reverse sort, but couldn't get it to work:
>>
>> perl -pi -e '$x=$_.$x}{$_=$x' in.file
>>
>> This prints to screen, not back to the file.
>> Any takers?
>
> (It prints to screen because the special output file is no longer
>select()ed. But you all knew that.)
>
> My take:
>
>perl -ni -e 'eof&&print;$\=$_.$\' in.file
>
>
>Eirik
>--
>GUIs normally make it simple to accomplish simple actions and
>impossible to accomplish complex actions.
> -- Doug Gwyn (in comp.unix.wizards on June 22, 1991)
>
-----------------------------------------------------------------
http://gbg.bg/search - Изпробвайте още сега най-добрата българска търсачка!
>--- Jasper <jasper...@gmail.com> wrote:
>
>
>>Nice. Perhaps it'll prompt a new compo soon :)
>>
>>
>
>Ahhh .. how I long for the good old days.
>
>
So do I, so do I. In fact, as nostalgia settles in, I've found
myself toying more and more these days with a type of competition that
would both encompass the Hermetic arts of golfing and allow for vicious
interaction between players. What I came up with is a Perl variation on
the old venerable Corewar game that, I think, might be great fun. For
some demented definition of fun, it goes without saying.
In all cases, I have attached to this post a draft of the rules of
the game. I hope to have the game engine (plus a web / email interface)
ready by mid-April. So if anyone's curiosity is piqued by the thing, I
might try to organize a public tournament then...
Joy,
`/anick
PS: Wonderful article, /-\ !
Yes, we all have to play this game! But have you considered a variant in
which the maximum snippet length decreases as the game goes on? This would
make the game progressively harder as you get towards the end.
--
Stephen Turner, Cambridge, UK http://homepage.ntlworld.com/adelie/stephen/
"Low Priced Cambridge Clare College. Big selection at eBay UK!"
(Ad after Google search for Clare College Cambridge)