Warning: preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 4 in /home/customer/www/theunixtips.com/public_html/wp-content/plugins/resume-builder/includes/class.resume-builder-enqueues.php on line 59

perl : Generate Random Data Natively

If you have the luxury to use Data::Random then use that by all means. But if that is not available (for example in production environment), here is another way to create some random data.

sub generate_random_data
	my $passwordsize = shift;
	my @alphanumeric = ('a'..'z', 'A'..'Z', 0..9);
	my $randpassword = join '',
	map $alphanumeric[rand @alphanumeric], 0..$passwordsize;

	return $randpassword;