in reply to generate list from users first name and name?

use utf8;
use Text::Unidecode qw(unidecode);
sub short {
    my @s = split ' ', (lc unidecode($_[0]) =~ tr/-//dr);
    $s[0] = substr $s[0], 0, 1;
    return join '', @s;
}
sub long {
    return lc unidecode($_[0]) =~ tr/ /./r =~ tr/-//dr
}

printf "%s\t%s\t%s\n", $_, short($_), long($_) for (
    'Ævar Arnfjörð Bjarmason',
    'Jérôme Mustermann',
    'Max Maier',
    'Rafaël Garcia-Suarez',
    'Rafael van der Vaart',
    'विश्वनाथन आनंद',
    '周潤發',
);
I can guess what you're up to. Don't just create account names! During sign-up, give these transformed names out as a suggestion, then let people confirm/change them.
  • Comment on Re: generate list from users first name and name?

Replies are listed 'Best First'.
Re^2: generate list from users first name and name?
by Skeeve (Parson) on Sep 14, 2012 at 15:29 UTC

    Don't just create account names! During sign-up, give these transformed names out as a suggestion, then let people confirm/change them.

    I'd like to second that, Imagine these poor guys and what you'll get...

    Alexander Shole Fabian Atas Georg Ayman Walter Hore


    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

      We had allwong @ ******.com. I wonder what was wrong with alwong.

Re^2: generate list from users first name and name?
by matze77 (Friar) on Sep 14, 2012 at 13:04 UTC
    Installed module from cpan, guess there might be missing some brackets e.g., maybe someone could help?:
    Bareword found where operator expected at test-perl-name.pl line 4, ne +ar "tr/-// dr" Bareword found where operator expected at test-perl-name.pl line 9, ne +ar "tr/ /. /r" Can't modify non-lvalue subroutine call in transliteration (tr///) at +test-perl- name.pl line 4, near "tr/-//dr" syntax error at test-perl-name.pl line 4, near "tr/-//dr" syntax error at test-perl-name.pl line 9, near "tr/ /./r " Execution of test-perl-name.pl aborted due to compilation errors.
    Thanks
    MH