#!/usr/local/bin/perl

use strict;
use List::Util qw(shuffle);
sub generatePassword;

print generatePassword(12);
exit;

sub generatePassword {
	my $length = shift;
	my $possible = 'abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
	my $tpassword;
	my $password;
	while (length($tpassword) < $length) {
		$tpassword .= substr($possible, (int(rand(length($possible)))), 1);
	}
	my $sp_possible = '$@!^&';
	$length += 2;
	while (length($tpassword) < $length) { 
                $tpassword .= substr($sp_possible, (int(rand(length($sp_possible)))), 1); 
        }
	my $n_possible = "23456789";
	$length += 2;
	while (length($tpassword) < $length) {  
                $tpassword .= substr($n_possible, (int(rand(length($n_possible)))), 1);  
        } 
	my @array = split(//, $tpassword);
	@array = shuffle @array;
	foreach my $char ( @array ) {
		$password .= $char;
	}
	
return $password
} 

__END__
