[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] print thyself [golf]





On Fri, 28 Apr 2000, Clifford Hammerschmidt wrote:
> We had a little competition at my work to come up with the shortest 
> (non-empty) perl script that could print itself. The winner (Jeff Anderson) 
> came up with:
> 
> $_=q(print "\$_=q($_);eval");eval

Here's mine.  It's the shortest one I've seen that doesn't cheat by
reading its source or playing silly eval tricks:

  printf+(q(printf+(q(%s))x2))x2

-- 
Ilmari Karonen
http://www.sci.fi/~iltzu/


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe