#!/usr/bin/perl use strict; my $DOWARN = 0; BEGIN { $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN } } my $symbol_list = "symbolsV1p1.dat"; my @symbol_pool = (); my $symbol_size = 0; my $index = 0; my $seed = "while "; my $embryo = $seed; my $MAX_ITER = 10; my $i = 0; my $result = undef; print "test.pl started...\n"; # Open my file list of symbols and functions # I will randomly jumble around and eval. open(SYMBOLS, "<$symbol_list") or die "Could not open $symbol_list: $!\n"; while () { chomp $_; print "symbol_pool character is: $_\n"; push(@symbol_pool, $_); } close(SYMBOLS); $index = int(rand($symbol_size)); print "Initial embryo is:\n$embryo\n"; while (1) { $embryo = $embryo . $symbol_pool[$index] . ";"; $result = eval($embryo); # Print out the successful string eval's if ($result != undef) { print "\n\nA working one liner has been generated!\n"; print "$embryo\n"; print "Line: $i\n\n"; $i++; } # Truncate the string to keep it from growing infinitely long if (length($embryo) >= 80) { $embryo = $seed; } # Stop the script after I get a few successful string eval's if ($i == $MAX_ITER) { print "Program finished\n"; exit(0); } $index = int(rand($symbol_size)); }