> 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 > > > > Can anyone come up with a shorter one? On Fri, Apr 28, 2000 at 02:05:40PM -0400, Rubinow, Larry wrote: > $ARGV[0]=$0;print while(<>); > > Or did I not understand the question? On Fri, Apr 28, 2000 at 07:06:46PM +0100, Alistair.McGlinchy@marks-and-spencer.com wrote: > An OS dependant solution: > print `type $0` > > A non-OS depent solution: > open I,$0;print<I> > > Or did I miss something here? I think the missing (implicit) rule is that the program must print its source code without just reading itself. In 'C', where the running program is typically a binary, this rule is pretty natural. In Perl, I suppose we could express this is as "must work with perl -e '<prog>'". Tom -- -- Tom Rathborne tomr@aceldama.com -- http://www.aceldama.com/~tomr/ -- "All that glitters is not gold; all that wander are not lost." ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe