#!/usr/bin/perl -w use strict; # redirect stderr to /dev/null when run, if you'd # like output of any use. my $chars= "abcdefghijklmnopqrstuvwxyz0123456789 `~!@#\$%^&*()-_=+[{]}\\|;:'\",<.>/?"; my $f = substr($chars, 0, 1); my $l = substr($chars, -1, 1); my $s = ""; while(length($s) < 5) { my @tmp; my $x; if (system("perl", "-ce", $s) == 0) { print $s . "\n"; } if ($s eq "") { $s = $f; next; } elsif ($s eq ($l x length($s))) { $s = $f x (length($s) + 1); next; } @tmp = split(//, $s); $x = @tmp - 1; while (1) { # loop through the string, starting at the end if ($tmp[$x] eq $l) { # Is it the last char? $tmp[$x] = $f; # If so, make it the first $x--; # And move on to the next one } else { # If not, just increment it. $tmp[$x] = substr($chars, index($chars, $tmp[$x]) + 1, 1); last; } } $s = join('', @tmp); }