in reply to Filling hashes
This may be of interest here.. This is a sub for generating a random string.
sub random_string { my $length_of_randomstring=shift;# the length of # the random string to generate my @chars=('a'..'z','A'..'Z','0'..'9','_'); my $random_string; foreach (1..$length_of_randomstring) { # rand @chars will generate a random # number between 0 and scalar @chars $random_string.=$chars[rand @chars]; } return $random_string; }
Usage is randmom_string(12);, you pass it the length you want the return string to be.
|
|---|