#! /usr/bin/perl open(PW,"ypcat passwd|") || die "How did you get logged in?"; while () { chomp; ($user, $gcos) = (split /:/)[0,4]; ($real) = split /,/, $gcos; ($first) = split /\s+/, $real; $names{$first} .= " $user;"; } foreach (keys %names) { $this = $names{$_}; if ($this =~ /; /) { print "$_ is used by:$this\n"; } }