you could use Perl's internal grep
http://perldoc.perl.org/functions/grep.html on the array, or you can create a hash
Code:
%group = ( AA => 1,
BA => 1,
CA => 1
);
I'm assuming this is just an exercise, hard-coding values like that is rare in prodn code.
Also, FYI, RH8 is waaaay old and unsupported, as is Perl 5.0.
Strongly advise you to move up to a modern distro eg the RH replacement distro Fedora core, which is now at v7(!)
Perl is now at 5.8 (per my link to the grep fn)