ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
Philip Newton (LJ OpenID) ([identity profile] pne.livejournal.com) wrote in [site community profile] changelog 2009-03-03 01:54 pm (UTC)

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.

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.)


Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org