in reply to what does @$ mean?

'@$msg' dereference the array reference '$msg'.
'join ("\n", @$msg )' is used for join the '$msg' array reference elements into a string separated by "\n". For eg.
#!/usr/bin/perl use strict; use warnings; my $msg = ['apple', 'banana', 'orange']; # array reference my @msg = @$msg; # dereferncing the arreay ref print "Dereferenced: @msg\n"; print join("\n",@$msg); # prints the array elem +ents sperated by "\n".
Please go through perlref and join for more information.