in reply to can I get a loop?
Assuming you have a hash ('%usernames') of the usernames already taken:
After which, '$username' will either contain the first unused username from '@usernames', or be undefined, if none were available.my $username; foreach (@usernames) { if (!exists $usernames{$_}) { $username = $_; last; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
A reply falls below the community's threshold of quality. You may see it by logging in. |
In Section
Seekers of Perl Wisdom