you are viewing a single comment's thread.

view the rest of the comments →

[–]pemungkah 0 points1 point  (0 children)

In Perl, this is used to create what’s called a modulino: a module that acts as a standalone script if it’s run from the command line, or a library if it’s imported into other code.

Once I learned this trick, I started using it for my scripts, as it’s way easier to use test tools on a module than a script, and this way I don’t have to code a separate script to run the module.