All pastes #249960 Raw Edit

BOO

public text v1 · immutable
#249960 ·published 2006-11-16 12:56 UTC
rendered paste body
#!/usr/bin/perl

use strict;
use warnings;

my $p    = shift;
my $arg  = "print '$p'";
my @arg  = split '', $arg;
my $str  = '';
my $str2 = '';
my %h;

my @t = ('!','@','#','$','%','^','&','*','(',')','-','_','=','+','[',
         ']','{','}','\\','|',',','.','<','>','?','/','~',';',':',"'",'"','`');

for my $x (@t){
  for my $y (@t){
    my $r = $x^$y;
    if (length($r) gt 1) { next; }
    if ($r =~ /[a-zA-Z0-9 !?']/){
      $x = ($x eq '\\') ? '\\\\' : $x;
      $y = ($y eq '\\') ? '\\\\' : $y;
      $x = ($x eq "'") ? "\\'" : $x;
      $y = ($y eq "'") ? "\\'" : $y;
      $h{$r}=$x.' '.$y;
    }
  }
}

foreach (@arg)
{
   my ($s, $s2) = split(' ', $h{$_});
   $str  .= $s;
   $str2 .= $s2;
}

print "''=~('(?{'.('$str'^'$str2').',\$/})');"

__END__

This code is a little generator of weird Perl code.

Usage: $0 "Your name here"

This will generate a executable Perl string like that:

''=~('(?{'.('//)./`|"/./`.:-:`(:/:|'^'_]@@[@[{@[]@@[@_@@_]_[').',$/})');

Enjoy !