Perl code to create random string of characters

mixed-case, alphanumeric, 8 chars long

http://www.perlmonks.org/?node_id=233023

#!/usr/bin/perl -wT

use strict;

my @chars = ("A".."Z", "a".."z", "0" .. "9");
my $string;
$string .= $chars[rand @chars] for 1..8;

print $string . "\n";

#perl #programming

From JR's : articles
32 words - 250 chars
created on
updated on - #
source - versions

Related articles
Quotes in Perl - Oct 12, 2013
Test Automation using Perl - May 17, 2013
Perl Timer Code - Feb 11, 2015
Interview with Mojo Mail author - November 2002 - Jul 18, 2014
Perl regex extracting domain name from URL - Oct 02, 2013
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: May 21, 2024 - 5:46 p.m. EDT