A couple of hopefully helpful observations.
- g != G you are checking for the presence of a character that never appears in your list.
- you return a straight string comparison of $a and $b, you should be comparing their cumulative G and C counts.
- the "spaceship operator" <=> is used for numerical comparison.
- And finally, a hint: Regular expressions return the number of times they matched when called in a scalar context
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."