Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: generate list from users first name and name?

by daxim (Chaplain)
on Sep 14, 2012 at 11:46 UTC ( #993705=note: print w/ replies, xml ) Need Help??


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 Arnfjr Bjarmason',
    'Jrme Mustermann',
    'Max Maier',
    'Rafal 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?
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
Re^2: generate list from users first name and name?
by Skeeve (Vicar) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993705]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2014-12-20 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (99 votes), past polls