Article 11048 of comp.lang.perl:
Newsgroups: comp.lang.perl
Path: feenix.metronet.com!news.utdallas.edu!convex!cs.utexas.edu!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news.kei.com!ub!acsu.buffalo.edu!boyd
From: [email protected] (Daniel F Boyd)
Subject: Re: Self-modifying code?
Message-ID: <[email protected]>
Sender: [email protected]
Nntp-Posting-Host: hydra.cs.buffalo.edu
Reply-To: [email protected] (Daniel F Boyd)
Organization: University @ Buffalo
References: <[email protected]>
Distribution: na
Date: Mon, 28 Feb 1994 03:34:44 GMT
Lines: 20

In article <[email protected]>,
Ajay Shekhawat <[email protected]> wrote:
>       - (not related) Has anyone written a self-reproducing Perl script,
>         which does not do any file I/O? (maybe this is a FAQ...)

Here is my self-reproducing Perl script.  Bonus: Since we're both at
Buffalo the pathname is correct for our machines (and probably nowhere
else).

#!/util/bin/perl
$s = q@($t = $s) =~ s/\045/\100/g;
print "#!/util/bin/perl\n\$s = q%$s%;$t";
@;($t = $s) =~ s/\045/\100/g;
print "#!/util/bin/perl\n\$s = q@$s@;$t";


Daniel F. Boyd -- [email protected]

WARNING: Contains small parts.  Not suitable for children under 3.  Do
not induce vomiting.  Do not exceed 4 doses in a 24-hour period.