Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: can I get a loop?
by kilinrax (Deacon) on Feb 05, 2001 at 23:40 UTC
    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.
    A reply falls below the community's threshold of quality. You may see it by logging in.