You are assigning the value of
$name to the result of a substitution on the default variable
$_ reread
perlre and check the syntax used to perform regex operations on a variable again.
PS: The g modifier is unnecessary in your subsitution
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."