Hopefully I won't get fragged to badly for suggesting a non-PERL answer, but if you're running NT,
`net localgroups`
and
`net group`
return lists of groups. Use both at a command prompt to see what the results look like, and get ready to parse the results.