my @chars = ("a".."z","A".."Z"); my $random_string = join("",@chars[map{ rand @chars} (1..8)])); #8 being the number of chars to randomize ofcourse