Re: Re: Perl golf article at Perl Monks
Vidul Petrov <[email protected]> Thu, 10 Mar 2005 21:06:00 +0200 (EET)
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
Traditional way: perl -i -ne 'unshift@_,$_;eof&&print@_' in.file >-------- Оригинално РїРёСЃРјРѕ -------- >РћС‚: Eirik Berg Hanssen <[email protected]> >Относно: Re: Perl golf article at Perl Monks >До: Ala Qumsieh <[email protected]> >Рзпратено РЅР°: Четвъвтък, 2005, Март 10 20:40:18 EET >---------------------------------- > >Ala Qumsieh <[email protected]> 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 - Рзпробвайте още сега най-добрата българска търсачка!