home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / perl / 7070 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  1.2 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!bmdhh243!bcars267!bnrgate!nott!cunews!revcan!semifs1!lalonde
  2. From: lalonde@semifs1 (Terry Lalonde)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Need tidbit of code to look up user's full name
  5. Message-ID: <13574@semifs1>
  6. Date: 19 Nov 92 18:07:20 GMT
  7. References: <1992Nov19.025121.4550@cis.ohio-state.edu>
  8. Reply-To: lalonde@semi.mitel.com
  9. Distribution: usa
  10. Organization: Mitel Semiconductor
  11. Lines: 26
  12.  
  13. fontana@iguana.cis.ohio-state.edu (Mark Fontana) writes:
  14.  
  15.  
  16. >Hi,
  17.  
  18. >I'm just beginning to learn perl, and I would like to have a program
  19. >determine the first name of the user invoking it.  Presently, it
  20. >gets the user's login name through environment variable USER.  I
  21. >would like the program to determine the user's full name (by checking
  22. >the gecos(?) field).  I'd appreciate it if someone could give an
  23. >example of how to do this.
  24.  
  25. >Thanks,
  26.  
  27. >Mark Fontana
  28.  
  29. Try:
  30.  
  31.                     ($first,$last) = split(' ',(getpwuid($<))[6]);
  32. Terry
  33.  
  34. -- 
  35. ==============================================================================
  36. Terry Lalonde (613)592-2122   | "the war between mainframes and micros is over
  37. Usenet:...!uunet!mitel!lalonde| and the network has won" 
  38. Internet: lalonde@mitel.com   |                Editors Network Computing 01/91  
  39.