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: boyd@cs.buffalo.edu (Daniel F Boyd) Subject: Re: Self-modifying code? Message-ID: Sender: nntp@acsu.buffalo.edu Nntp-Posting-Host: hydra.cs.buffalo.edu Reply-To: boyd@acsu.buffalo.edu (Daniel F Boyd) Organization: University @ Buffalo References: Distribution: na Date: Mon, 28 Feb 1994 03:34:44 GMT Lines: 20 In article , Ajay Shekhawat 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 -- boyd@cs.buffalo.edu WARNING: Contains small parts. Not suitable for children under 3. Do not induce vomiting. Do not exceed 4 doses in a 24-hour period.