Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.lang.perl Subject: Re: Self-reproducing program Message-ID: <1991Mar27.172212.18930@iwarp.intel.com> Date: 27 Mar 91 17:22:12 GMT References: <1991Mar26.210348.12286@uvaarpa.Virginia.EDU> <.c5G=2v91@cs.psu.edu> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 22 In-Reply-To: flee@cs.psu.edu (Felix Lee) In article <.c5G=2v91@cs.psu.edu>, flee@cs (Felix Lee) writes: | Here's a shorter non-null self-reproducing program: | | printx 2 __END__ | printx 2 __END__ | | And here's one shorter, but less portable: | | open(Z,$0);print Here's a short *and* portable version of that: seek(DATA,0,0);print__END__ It even works as an arg to "perl -e"! $_ = "Just5another8Perl5hacker,"; s/(\D+)(\d)/pack("A$2",$1)/eg; print -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/