#!/usr/bin/perl use strict; use warnings; print "\nThis program is for people who don't know how to program", "\nin Perl. This program will write a program FOR YOU.", "\nYou don't have to do anything! Just run the program until", "\nyou get the desired result. How do you like that idea!?"; my $PROGRAM = "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\n"; my $PERL_PIECES = " (){;}\n0123456789\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-+[]<>|\\/:`'?!.,=~\@\$\%^&*#"; for (my $i = 0; $i < 30; $i++) { my $PTR = (rand() * 120) % length($PERL_PIECES); $PROGRAM .= substr($PERL_PIECES, $PTR, 1); } print "\n\n\nWe've come up with a great perl script just for you:\n", '-' x 75, "\n", $PROGRAM, "\n", '-' x 75; print "\n\n\nOkay. You ready? (y/n) "; $a = ; substr($a, 0, 1) eq 'y' or exit; open my $FILE, '>test1234.pl' or die 'Dude, I cant even create file!'; binmode $FILE; print $FILE $PROGRAM; close $FILE; chmod 0755, 'test1234.pl'; system('perl test1234.pl'); $a = ;