Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/perl
- use warnings;
- print "How many characters to use: ";
- chomp($how_many = <STDIN>);
- print "Which characters to use: ";
- chomp($characters = <STDIN>);
- print "Enter filename to save to:";
- chomp($filename = <STDIN>);
- open $fh, '>', $filename;
- sub doIt {
- my $i;
- if($_[1] eq 0) {
- print $fh $_[0]."\n";
- }
- else {
- for($i=0; $i le length($characters)-1; $i++) {
- doIt($_[0].substr($characters, $i, 1), $_[1]-1);
- }
- }
- }
- doIt("", $how_many);
- close($fh);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement