Breaking News
Home / Webmaster / Build Website / How to generate random string in Perl?

How to generate random string in Perl?

Snippet

  1. #########################
  2. # Generate Randon String
  3. #########################
  4. sub generate_random_string{
  5.      my $length_of_randomstring = shift;
  6.      my @chars=(‘a’..‘z’,‘A’..‘Z’,‘0’..‘9’);
  7.      my $random_string;
  8.  
  9.      for(my $i = 0; $i < $length_of_randomstring; $i++){
  10.      
  11.        $random_string .= $chars[int(rand(58))];
  12.   }
  13.  
  14.      return $random_string;
  15. }
[pb_builder]

Check Also

What is the best day to blog by PageViews?

Pageviews is a very important factor directly defining the traffic a website receives. The higher …

Advertisment ad adsense adlogger