home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!bnr.co.uk!bmdhh243!bcars267!bnrgate!nott!cunews!revcan!semifs1!lalonde
- From: lalonde@semifs1 (Terry Lalonde)
- Newsgroups: comp.lang.perl
- Subject: Re: Need tidbit of code to look up user's full name
- Message-ID: <13574@semifs1>
- Date: 19 Nov 92 18:07:20 GMT
- References: <1992Nov19.025121.4550@cis.ohio-state.edu>
- Reply-To: lalonde@semi.mitel.com
- Distribution: usa
- Organization: Mitel Semiconductor
- Lines: 26
-
- fontana@iguana.cis.ohio-state.edu (Mark Fontana) writes:
-
-
- >Hi,
-
- >I'm just beginning to learn perl, and I would like to have a program
- >determine the first name of the user invoking it. Presently, it
- >gets the user's login name through environment variable USER. I
- >would like the program to determine the user's full name (by checking
- >the gecos(?) field). I'd appreciate it if someone could give an
- >example of how to do this.
-
- >Thanks,
-
- >Mark Fontana
-
- Try:
-
- ($first,$last) = split(' ',(getpwuid($<))[6]);
- Terry
-
- --
- ==============================================================================
- Terry Lalonde (613)592-2122 | "the war between mainframes and micros is over
- Usenet:...!uunet!mitel!lalonde| and the network has won"
- Internet: lalonde@mitel.com | Editors Network Computing 01/91
-