in reply to count of USER UNIX groups

That's a bit vague... please see How do I post a question effectively? and perhaps you could explain a bit more about what you're trying to do and what you have tried so far.

Anyway, if you really just want a count of the existing UNIX groups, see getgrent (note: apparently the online doc for this version isn't showing up, but try the command perldoc -f getgrent), here's one quick way:

my $count = 0; $count++ while defined getgrent; print "$count\n";

Replies are listed 'Best First'.
Re^2: count of USER UNIX groups
by Apronline (Initiate) on Jan 25, 2015 at 06:34 UTC
    Sorry for the confusion! "groups $USER" in unix---> gives list of my unix groups. How can we get our unix groups list and count in perl? Thanks!

      A brief google leads to this node, which deals with listing a user's secondary groups, you can adapt the answers from there to suit your needs. The primary group of a user can be retrieved with getpwent. You may also want to use User::pwent and User::grent for a nicer interface to those functions.