Richard Bucker

It's never really the __END__ in Perl

Posted at — Jun 21, 2012

One of the really neat constructs of Perl is the END token. I do not know the origin, genus or species of this token but I like it. Back in the day when I was a contractor at IBM I was handed the tomb called ISO-9001. I don’t remember much of it anymore other than one or two facts.(1) every page that is numbered needs to be numbered thus:  “1 of 10”. The reason for numbering the document this way was to insure that the reader would know when they reached the end of the document.(2) similarly the author was required to identify when the reader had reached the end of the document. I do not remember what the ISO token was for the end of the document but over the years I have adopted “# # #”.It’s because of these rules that I have, out of habit or some deep seeded need to conform, that I always put some sort of tag at the end of every source file to indicate the EOF. And since Perl has this tag already defined… and with the exception of COBOL and maybe Fortran (I do not found forth, pascal, or prolog) it just made sense to me and so I keep doing it.It interesting to note that, in Perl, END is the end of the code and not the end of the file. Oh well.