in reply to what does @$ mean?

$msg is likely a reference to an array of text messages. @$msg dereferences that reference, turning it into an array of text messages. And those messages are joined together in your code example. See perlref and perlreftut.