UMBC CMSC 651, Automata Theory & Formal Languages, Spring 2003, Section 0101

A Perl program that prints itself


#!/usr/bin/perl $B = '$slash = "\x5C" ; print "#!/usr/bin/perl\n\n" ; $C = $B ; $C =~ s/\'/$slash\'/g ; print "\$B = \'$C\' ;\n" ; print "$B\n" ;' ; $slash = "\x5C" ; print "#!/usr/bin/perl\n\n" ; $C = $B ; $C =~ s/'/$slash'/g ; print "\$B = '$C' ;\n" ; print "$B\n" ;


Last modified: 22 Jul 2024 11:31:05 EDT by Richard Chang, chang@umbc.edu
to Spring 2003 CMSC 651 Homepage