Node ID from hook_comment_insert
print_r($variable) does not return anything useful, it just outputs text (which it does successfully, so it returns boolean TRUE [which is rendered as 1 when printed]). Your drupal_set_message basically does something like echo ($string . $boolean . $string)

Use print_r($variable, true) to return the output of the print_r to the calling function, instead of rendering it.

See https://www.php.net/manual/function.print-r.php