Try adding an s modifier to the end of your precompiled regex, and try again., ie.,
qr{HOSTNAME:\s*(?:\d{4}-)?$dev_ref->{hostname}\s+GRBR:\s*$dev_ref->{grbr}}is;
-- Adam
Update: Ya know - cancel that, I was having some regex confusion of my own :-)... your code works for me - I'd go with the suggestion to look for those special chars... If this might be the case, I'd instinctively go with a slightly cleaner something like:
$pattern = qr|hostname: $dev_ref->{hostname}\s+GRB+R: $dev_ref->{grbr}|is;
--
By a scallop's forelocks!