The input specified in the
here document construct described by
Baron_Saturday is treated as a double-quoted string:
variables are expanded. So the (
Bourne shell) sequence
hi=hello
echo $hi | mail `whoami`
mail `whoami` <<ZZ
$hi
ZZ
will actually give you two identical mail messages, with a body of hello.
Perl has this, too, and adds a variant that takes the input literally.