I wrote earlier today:
> I'm working on a better version which I'll post tonight. It now splits on
> the semicolon and then lets me process the username separately.
Here's what I came up with (after peeking at the tips you all posted here).
Be kind - it only looks simple to you! ;-)
-------------------------------
#!/usr/bin/perl -w
use strict;
# data format:
# [id];[username]
# 12;i.longlastname (if period, remove and truncate to 11 char)
# 999;namewithoutperiod (do not truncate)
while (<>) {
chomp; #chomp because of truncation
my ($userid, $username) = split (/;/,$_,2);
if ($username =~ tr/.//d) {
$username = substr($username,0,11);
}
print "$userid;$username\n"; #print to screen for now
}
--------------------------------
--
Kevin Pfeiffer <[EMAIL PROTECTED]> - www.iu-bremen.de
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]