These are small examples showing the use of https://en.wikipedia.org/wiki/Here_document which is also called multi-line raw strings or literal string.
This is done in Perl, Ruby, Python and C++11. These raw strings can contain any text in them, including embedded strings and escape characters. In addition, one can use sprintf like operations on them by replacing some tokens that have %s in them, with variables after building the strings. The main use of this is to be able to generate Latex directly from another language, such as Mathematica or Perl or Python, etc... since there are cases where it is easier to do this than coding the logic direclty in Latex itself. Some usage examples are below
Now running the above script t.rb gives
Notice that % in the raw string (the percentage sign) had to also have a place holder to avoid conﬂict with the % used for string replacement. In the Perl example below, this is not needed.
Which is very similar to Ruby. Except in Ruby there was no need to add s after the place holder. Also, the % in the raw string had to be special handled the same as with Ruby.
In Perl however, the %, does not need special handling
Notice how the 100% was left as is. No place holder was needed for it in Perl.
However, the C++ solution is not as ﬂexible as the others, since it does not support named place holders which makes it little harder to replace tokens in the raw string if there are many of them.