in reply to Re: A string from a file
in thread A string from a file

Or if you worry about the tokens not being in the hash:
$msg =~ s/__(\w+?)__/(defined $SWAPS{$1})?$SWAPS{$1}:"__$1__"/eg