http://qs1969.pair.com?node_id=56484


in reply to can I get a loop?

Assuming you have a hash ('%usernames') of the usernames already taken:
my $username; foreach (@usernames) { if (!exists $usernames{$_}) { $username = $_; last; } }
After which, '$username' will either contain the first unused username from '@usernames', or be undefined, if none were available.