[LON-CAPA-dev] lcscripts patch
Martin Siegert
lon-capa-dev@mail.lon-capa.org
Thu, 7 Apr 2005 16:09:47 -0700
Hi Guy,
On Thu, Apr 07, 2005 at 06:28:14PM -0400, Guy Albertelli II wrote:
> Instead of
> my $group = `awk -F: '{if (\$3 == '$gid') print \$1}' /etc/group`;
>
> I went with this instead:
> my ($group) = getgrgid($gid);
Amazing. I do not know how many perl scripts I wrote that use the ugly
awk workaround above. Simply because I couldn't find a perl function
that woudl do the thing directly. Now this Guy comes up with "getgrgid".
And it is even in the perl book...
I must be getting blind. Sigh. And thanks. I promise to use it in the
future.
Cheers,
Martin