I'm not sure your example will completely work as shown. The first shift in your sub will pull off a reference to the array, not the array itself. So the sub should look something like:
sub cog_class {
my $cog_ids_ref = shift;
my $name = shift;
print "NAME $name\n";
for my $id ( @{$cog_ids_ref} ){
# BLAH BLAH
}
}