Skip to content

Instantly share code, notes, and snippets.

@tokuhirom
Created July 8, 2011 04:28
Show Gist options
  • Save tokuhirom/1071145 to your computer and use it in GitHub Desktop.
Save tokuhirom/1071145 to your computer and use it in GitHub Desktop.
sub random_string {
my $length = shift;
my @chars = ( 'A' .. 'Z', 'a' .. 'z', '0' .. '9' );
my $ret;
for ( 1 .. $length ) {
$ret .= $chars[ int rand @chars ];
}
return $ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment