Search code examples
language-agnosticsyntaxprogramming-languagescomparisonlanguage-comparisons

Similar language features to compare with Perl and Ruby __END__


Background

Perl and Ruby have the __END__ and __DATA__ tokens that allow embedding of arbitrary data directly inside a source code file.

Although this practice may not be well-advised for general-purpose programming use, it is pretty useful for "one-off" quick scripts for routine tasks.

Question:

What other programming languages support this same or similar feature, and how do they do it?


Solution

  • Perl supports the __DATA__ marker, which you can access the contents of as though it were a regular file handle.