Xref: utzoo alt.sources:1551 comp.lang.perl:521 Path: utzoo!attcan!uunet!shelby!apple!oliveb!orc!mipos3!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: alt.sources,comp.lang.perl Subject: Re: Version of id(1). Message-ID: <1990Mar2.210209.11209@iwarp.intel.com> Date: 2 Mar 90 21:02:09 GMT References: <426@clover.warwick.ac.uk> <2964@jato.Jpl.Nasa.Gov> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Followup-To: alt.sources Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 53 In-Reply-To: lwall@jato.Jpl.Nasa.Gov (Larry Wall) In article <2964@jato.Jpl.Nasa.Gov>, lwall@jato (Larry Wall) writes: [21 lines of code deleted...] | No doubt Randal could write it shorter... Well, OK, taking on the challenge, how about: #!/usr/bin/perl sub u { local($name)=getpwuid($_[0]); $name && "($name)";} sub g { local($name)=getgrgid($_[0]); $name && "($name)";} sub bynum { $a - $b; } print "uid=$<",&u($<); print " gid=", $(+0,&g($(); print " euid=$>",&u($>) if $> != $<; print " egid=", $)+0,&g($)) if $) != $(; @groups=split(' ',$(); shift(@groups); print " groups=", join(',',sort bynum grep(($_ .= &g($_)) || 1, @groups)) unless $#groups < $[; print "\n"; Something like that, Larry? print pack('C25',grep($_ = 32 + y/ / /, split(/\n/, <