my @res = grep { $_ } split( /\r?\n/, LJ::load_include( 'reserved-usernames' ) );
At first I was puzzled by the seemingly-useless grep { $_ } list, since I first thought that would simply pass through everything anyway; I presume it's to weed out empty lines.
grep { $_ } list
In which case, why not say so:
my @res = grep length($_) > 0, split( /\r?\n/, LJ::load_include( 'reserved-usernames' ) );
which would have the (admittedly minuscule) advantage of allowing "0" as a reserved username.
(And IIRC, grep expression, list is, in general, faster than grep { block } list.)
grep expression, list
grep { block } list
If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org
Other options:
no subject
At first I was puzzled by the seemingly-useless
grep { $_ } list
, since I first thought that would simply pass through everything anyway; I presume it's to weed out empty lines.In which case, why not say so:
my @res = grep length($_) > 0, split( /\r?\n/, LJ::load_include( 'reserved-usernames' ) );
which would have the (admittedly minuscule) advantage of allowing "0" as a reserved username.
(And IIRC,
grep expression, list
is, in general, faster thangrep { block } list
.)