Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-28-2004, 12:03 AM   #1
LQ Newbie
Registered: Sep 2003
Location: Sydney, Australia
Distribution: ubuntu, suse, redhat
Posts: 18

Rep: Reputation: 0
Lightbulb creating userid's in perl

I want to write a perl script to read in a csv file in the format of :

for example:

I want to extract the first letter of the first and middile names and add them to the front of the last name to create a near unique userid. In the example above, this would mean that the userid would be rasmith (I also want it all in lower case).

Anybody got a simple perl script to do it?
Old 01-28-2004, 01:23 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Here is one that will read from stdin and output in csv with a leading field containing the userid:

print lc(substr($field[0],0,1).substr($field[1],0,1).$field[2]).",".$_;



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl/CGI Creating Auto Logouts (like bank sites) anthonysaulnier Programming 3 10-17-2005 12:36 PM
Userid's and Deamons RonV Linux - Newbie 2 04-29-2005 07:55 PM
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration