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


in reply to Assigning Null to a variable

for (1..$length) { my $alphanumber .= $chars[int rand @chars]; } ^^

Most likely, your real problem is the above my ...