Das habe ich gerade geschrieben, bei Fragen könnt ihr euch gerne melden.

Hier nochmal im Pastebin:http://pastebin.com/yWDVZT0k

Code:
#! /usr/bin/perl 

use warnings;

print "How many characters to use: ";
chomp($how_many = <STDIN>);

print "Which characters to use: ";
chomp($characters = <STDIN>);

sub doIt {
    my $i;
    if($_[1] eq 0) {
        print $_[0]."\n";
    }
    else {
        for($i=0; $i le length($characters)-1; $i++) {
            doIt($_[0].substr($characters, $i, 1), $_[1]-1);
        }
    }
}

doIt("", $how_many);