#!/usr/bin/perl use strict; use warnings; my @A = 'A' .. 'Z'; my @B = 1 .. 100; my $size = 10; my %strings; while (keys %strings < $size) { $strings{ $A[rand @A] . '-' . $B[rand @B] } = 1; } print join ',', keys %strings;