Using CPerl Mode in Emacs when writing test files

When developing in Perl using Emacs, I usually adopt the cperl-mode major mode, that works great for my needs. However, this mode is not enabled by default when editing test files, that is those with the .t extension.
Luckily, Emacs is totally customizable, and therefore it does suffice to add something the following line in the startup configuration file to get the trick:

(add-to-list 'auto-mode-alist '("\\.t\\'" . cperl-mode))



and, after the evaluation, every time Emacs will visit a test file with .t extension the CPerl Mode will be automatically loaded.

The article Using CPerl Mode in Emacs when writing test files has been posted by Luca Ferrari on September 8, 2023