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

Re: [FWP] print thyself [golf]



On Fri, Apr 28, 2000 at 01:05:40PM -0500, Rubinow, Larry wrote:
> 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?
> 
> $ARGV[0]=$0;print while(<>);
> 
> Or did I not understand the question?

I guess there are a lot of different interpretations here. It depends
wether you call the program with "perl scriptname" or just scriptname
by itself.

I guess the shortest complete perlscript would be this:

#!/usr/bin/perl
@ARGV=$0;die<>

-Sven
-- 
I know you think you thought you knew what you thought I said,
but I'm not sure you understood what you thought I meant.

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